Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Siri Shortcuts, Sonoma, iOS 17 "No Flexible Matching Assets"
We have an app that uses Siri Shortcuts in iOS 16. WWDC '23 announced more flexible shortcut phrase matching in iOS 17 when apps are built with Xcode 15 run on Sonoma. I've downloaded and installed (Xcode and Sonoma) and rebuilt the app. I've ensured that "APP_SHORTCUTS_ENABLE_FLEXIBLE_MATCHING = YES" in the Build Settings. Unfortunately the App Shortcuts Preview Window shows the following error when I click on my build "No Flexible Matching Assets - This target is for a platform which is not supported by Flexible Matching or does not have Flexible Matching enabled" Other things I tried: I set our minimum deployment target to iOS 17 and built for an iOS 17 Simulator. Any ideas on how to get flexible matching for shortcut phrases?
5
4
1.2k
Jun ’23
ImageResource properties name and bundle as public getters
Hi, I love the idea of the ImageResource struct and it is a great error reduction to automatically provide an ImageResource for every Image in the asset catalog. I immediately started to adopt it. But I have a case where I would still need to have access to the name of the Image and the bundle. So I would suggest that you provide change the struct for ImageResource to have name and bundle as public getters. With this, there is still a safe way in the code to access the resource and still be able to use the name of the resource. So instead of generating: struct ImageResource: Hashable { /// An asset catalog image resource name. fileprivate let name: String /// An asset catalog image resource bundle. fileprivate let bundle: Bundle /// Initialize an `ImageResource` with `name` and `bundle`. init(name: String, bundle: Bundle) { self.name = name self.bundle = bundle } } Just generate it as: struct ImageResource: Hashable { /// An asset catalog image resource name. let name: String /// An asset catalog image resource bundle. let bundle: Bundle /// Initialize an `ImageResource` with `name` and `bundle`. init(name: String, bundle: Bundle) { self.name = name self.bundle = bundle } } The same applies to ColorResource as well. I have posted a feedback on this, but I am curious what others think about this? Am I the only one who still needs to have access to the name and the bundle of the ressource?
3
1
1.9k
Jun ’23
Are Swift Packages supported by String Catalogs?
Hello, do the String Catalogs (new in Xcode 15) support Swift Packages? I've tried adding a new Localizable.xcstrings (string catalog) file to my package's resources folder. Great! I then see this screen: All good so far. I then try to go and build my Swift Package... and nothing changes. The string catalog is never populated and I'm left with the same screen as above. So, do string catalogs not support packages at this time or am I doing something wrong? I was really hoping String Catalogs would work and save the day since Export Localizations also does not work for Swift packages that don't support macOS. 😔
7
0
4.2k
Jun ’23
xcode cloud ci_scripts failing with unexpected EOF while looking for matching `''
Hello , I am facing following error while building my project on xcode cloud using custom ci scripts . Error: ci_post_clone.sh script is failing with following error. Run command: 'cd /Volumes/workspace/repository/ci_scripts && /Volumes/workspace/repository/ci_scripts/ci_post_clone.sh' /Volumes/Task/ci_plan.env: line 2: unexpected EOF while looking for matching `'' /Volumes/Task/ci_plan.env: line 3: syntax error: unexpected end of file Here is my script : ci_post_clone.sh #!/bin/sh touch availCert-dev.p12 touch availCert-qa.p12 touch availCert-stage.p12 touch availCert-prod.p12 ls -la It also shows a warning message for shebang: The ci_post_clone.sh is executable but exited with 1 exit code. Make sure a valid shebang line is specified if the file is a script and that the interpreter specified in the shebang line is supported on Xcode Cloud. I will be appreciative for response on this issue. Thank You
3
1
3.0k
Jun ’23
Xcode 15 beta doesn't show my phone
I installed Xcode 15 without downloading iOS 17 simulator. When I opened my iOS app project in it, Xcode showed "iOS 17.0 not installed". This is as expected. My question, however, is that after I connected my phone, it's shown in "Manage run destination", but not in Xcode deployment target selection list. Does anyone know if this is as expected? Do I have to install iOS 17 simulator to get my device shown in Xcode? Thanks.
7
7
4.9k
Jun ’23
Run UI tests on multiple devices in succession?
The new test report, with the automatic video recording and scrubber, is great. I'm setting up different configurations for different languages to improve localization testing, but I was wondering if it was possible to make the simulator device type part of the configuration. For example, I'd like to have a single test plan with an "iPhone 14" test plan, an "iPad Air" test plan, etc. Then I would just press Cmd-U, and Xcode would run through each device in sequence, leaving me with videos of each test run that I could review in the test report. Is that possible?
2
1
2k
Jun ’23
Xcode 15 beta strings catalog
Hey, I'm trying the new strings catalog, and I have a script that I would like to run on the xcstrings json. My question is there some documentation on the json format (what keys can it have, and values)? Also, I didn't try it yet, but what if I set for example 50 languages and 1000 localization keys, is that json really scalable? It could grow quite large, would xcode still keep it as one big file, or it would somehow split it into chunks? Would be happy for any info from the dev teams, thanks!
2
1
2k
Jun ’23
Xcode 15 OSLog "Jump to source" not working inside Package
Hi. I want to use OSLog. It is working as expected inside my controller. I can view all details in the console and can use "jump to source" and it jumps to the source code :) NICE If I call this inside a package in side a static func like this Package Example: import OSLog class A { static func testLog(meesage: String) { Logger(subsystem: "Test", category: "console").info("\(message)") } } I can the message inside the console but "Jump to soure" is not working. Only a ? appears on screen. Did I miss anything ?
4
0
1.6k
Jun ’23
Why doesn't the Apple Vision Pro simulator appear as a run destination?
Throughout the WWDC guides and videos, Apple claims existing iOS and iPadOS apps will run in the visionOS Pro Simulator "unmodified." But none of my existing UIKit apps do. xrOS is installed and it does run for new project templates. But even after making sure "Apple Vision (Designed for iPad)" is added to my project settings, the destination never appears in the picker UI. What is Xcode detecting? If existing apps must be using SwiftUI or somesuch, then Apple needs to state that as a requirement. And if that is the case, is there a migration example of meeting this requirement without breaking or rewriting my apps?
8
3
3.5k
Jun ’23
Archive Build failed " Command SetOwnerAndGroup failed with a nonzero exit code" in Xcode 14
According to the WWDC202310224 "Simplify distribution in Xcode and Xcode Cloud" video, there are two questions about my development process. First, the developer must use "Development Profile" to config Signing & Capability instead of "Developer ID Application profile" for building Applications? shown as the pictures below Second, after build application successfully with "Development Profile", process Product -> archive will fail with "Command SetOwnerAndGroup failed with a nonzero exit code" error message, I have no idea how to solve this problem. Cloud you please tell me how to successfully archive the DriverKit application step by step and further directly distribute Application ? Thanks for your helpful support.
5
0
5.4k
Jun ’23
Xcode stuck waiting for device to unlock, waiting for symbols, etc.
I have chronic problems with the connection between Xcode and my phone. I plug the phone in and Xcode says "Waiting for phone to unlock", but the phone is already unlocked. I try locking and unlocking it, but nothing happens. If I can get past this problem by disconnection and reconnecting the phone a couple of times, it gets into the "downloading symbols" phase and never gets out of it. Finally, even though I have checked the "Connect via network" option, it never works, and I can never connect unless I plug in the phone with a USB cord (yes, the phone and the computer are on the same Wifi network). Some days this is just an annoyance, but some days (like today) I really need to test something on my phone for a customer who's waiting for it, and I cannot. The thing I'm trying to test involves sending text messages so I can't use the simulator or even an iPad. What can I do to debug this problem?
5
2
4.0k
Jun ’23
Xcode 15 beta 2: Failed to install iOS app with widget extension to simulator or device, because widget extension is does not define either an NSExtensionMainStoryboard or NSExtensionPrincipalClass key with a string value in the NSExtension dictionar
Xcode: Version 15.0 beta 2 (15A5161b) iPhone: iOS 17.0 (21A5268h) Run from Xcode to Simulator or my iPhone, build successfully, install failed with the same error: My widget extension target info.plist file looks like the image below, and it worked find with all the previous Xcode version. After adding the key NSExtensionPrincipalClass like this: I can install my app to simaltor and my device, however, when archive and upload to the App Store (for TestFlight testing), i got another error (the first one is related to this issue, the second i could not figure out what it is):
3
1
2.0k
Jun ’23
Crash When Run app On Xcode15 Simulator
When UICollectionViewFlowLayoutAlertForInvalidItemSize Occured Some Log Like These Occurred, and then app crash *** Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410 crash Output *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 16}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.'
31
6
22k
Jul ’23
Incorrect image alpha rendering on Xcode 15b3 and iOS 17
I'm not sure if I'm changed an unknown-to-me setting somewhere, but since this morning, after profiling an app (metal, allocations, etc), every project I run/build on Xcode 15b3, either on simulator or on device, displays partially-alpha images blended to black, as if there was some problem in the process of compiling the PNGs (lack of premultiplying, color space, etc). If I open those same projects on Xcode 14, they are displayed everything as they should. Also, If I open them on other computers with Xcode 15b3 other than mine, it also works fine. And it was working fine for me this morning as well, but not anymore. I've tried uninstalling Xcode beta and the simulator a few times, cleaning folders and preferences, hoping it was some setting I changed by mistake with some hotkey, but no luck so far. I'll attach two pictures, one from Xcode 14, and the other one from Xcode 15b3, hoping it's some silly thing I'm missing. xc15b3: xc14:
21
5
5.2k
Jul ’23
Any better way to write multi-family Widget #Preview macro?
Hello, In WidgetKit, I have to write multiple #Preview macros for each family the widget supports. So is there any better way to write the #Preview? (Although I can use the legacy PreviewProvider but it does not support timeline to test transition animation.) #import WidgetKit #import SwiftUI struct DailyCaffeineWidget: Widget { ... } @available(iOS 17.0, *) #Preview("Inline", as: .accessoryInline) { DailyCaffeineWidget() } timelineProvider: { previewTimelineProvider() } @available(iOS 17.0, *) #Preview("Circular", as: .accessoryCircular) { DailyCaffeineWidget() } timelineProvider: { previewTimelineProvider() } @available(iOS 17.0, *) #Preview("Rectangular", as: .accessoryRectangular) { DailyCaffeineWidget() } timelineProvider: { previewTimelineProvider() } @available(iOS 17.0, *) #Preview("Small", as: .systemSmall) { DailyCaffeineWidget() } timelineProvider: { previewTimelineProvider() } @available(iOS 17.0, *) #Preview("Medium", as: .systemMedium) { DailyCaffeineWidget() } timelineProvider: { previewTimelineProvider() } ...
2
2
1.7k
Jul ’23
no exact matches in reference to static method 'buildExpression'
This error ( no exact matches in reference to static method 'buildExpression' ) keeps occurring in my content view on the line that states .environmentObject(registrationViewModel). Here is the ContentView code: import SwiftUI struct ContentView: View { @StateObject var viewModel = ContentViewModel() @StateObject var registrationViewModel = RegistrationViewModel() var body: some View { Group { if viewModel.userSession == nil { LoginView() .environmentObject(registrationViewModel) } else if let currentUser = viewModel.currentUser { MainTabView(user: currentUser) } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } Here is the RegistrationViewModel code: import Foundation class RegistrationViewModel: ObservableObject { @Published var username = "" @Published var email = "" @Published var password = "" func createUser() async throws { try await AuthService.shared.createUser(email: email, password: password, username: username) } } Here is some more info about the error: Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent') Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent') Candidate requires that 'some View' conform to 'TableRowContent' (requirement specified as 'Content' : 'TableRowContent') Candidate requires that 'some View' conform to 'Commands' (requirement specified as 'Content' : 'Commands') I have been trying to figure out this error for 2 days! Please help! Thanks
2
0
2.7k
Jul ’23