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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Unable to debug app on phone
After updating macOS (macbook M2 Max) to Version 15.0 Beta (24A5298h) and running Xcode version 16.0 beta 4 (16A5211f), I am no longer able to debug apps on phones due to that I can not load them to the phone (even with cable connection). I had no issues in the past with these phones. The error message in Xcode is "Previous preparation error: Developer Mode disabled; To use iPhone for development, enable Developer Mode in Settings → Privacy & Security." But the phones are in Developer mode. Updating phones to a later iOS version does not help. Also, going back in Xcode does not help, as with macOS 15.0 Beta you need to have Xcode 16.0 Trying other phones that worked in the past does not help. Reinstalling Xcode does not help either. I see the phones in Finder, so there is a connection. Enabling/Disabling the Developer mode switch on the phone does not help either. Rebooting devices neither. Tried everything available on the internet, but no results. Need to test on phones, as I am using AR, which doesn't to run with the simulator.
13
3
1.6k
Sep ’24
How to Download IOS 26 beta runtime simulator using "xcodebuild" tool?
How to download the runtime simulators for the most recent Xcode 26 beta? The current download command I’m using doesn’t seem to work, and I’m encountering the following issues: The runtime simulator download command (xcodebuild) requires the version number to be specified explicitly. I’ve tried multiple variations of version names/numbers but haven’t been able to identify the correct naming convention used by Apple for the Xcode 26 beta simulator runtimes. $ xcodebuild -downloadPlatform IOS -exportPath ~/Downloads -buildVersion 26 Finding content...iOS 26 is not available for download. $ xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion 26.0 Finding content...iOS 26.0 is not available for download. $ xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion 26.0 beta Finding content...iOS 26.0 is not available for download. $ xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion "26.0 beta" Finding content...iOS 26.0 beta is not available for download. $ xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion "26.0_beta" Finding content...iOS 26.0_beta is not available for download. $ xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion 26.0_beta Finding content...iOS 26.0_beta is not available for download.
3
3
353
Jun ’25
ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription
Hello, I'm seeing many errors like this in the Xcode debug console when I build and run my app: ERROR: Unrecognized attribute string flag '?' in attribute string "T@"NSString",?,R,C" for property debugDescription The app project makes heavy use of Logger(), and I suspect it is related to that logging in some way, but I haven't been able to narrow down the issue to specific log calls. I have Category, Subsystem and Timestamp enabled in the Xcode console, but none of those are displayed for this output. What causes this? Or how can I better narrow down the source?
4
3
949
Feb ’25
App Tracking Transparency permission request iPadOS 18.3.1.
I implemented AppTrackingTransparency framework but Apple is rejecting the review because it seems the request is failing on iPadOS 18.3.1. which seems rare since it is working on all other devices. Has anyone faced the same issue? I have tested this in a physical iPhone with IOS 18.3.1 and in several devices using Xcode runtime simulator including iPad and iPhone in different IOS versions up to 18.2 (which I understand is the latest available in Xcode). The problem is that 18.3.1 runtime simulator is not available yet. Does anyone have more information when it will be available or what to do in these cases?
5
3
975
Feb ’25
Updateign provisioning taking forever
Hello, in the past couple of weeks I've been experience some problems with xcode regarding the signing & capabilities. I work in a company that makes customized apps for every of our clients and beacause of that we have about 200 targets in our project. In the past couple of weeks, I have been hanving trouble with the signing & capabilities in xcode. Some times is taking too long to load the poart where i select the team were the app will be upload and when it does it got stuck with the massege updating provisioning . There is anything that could have been done to not take too much time to the target get ready to be publiched? Thanks in advanced for any help.
2
3
1.2k
Sep ’24
SwiftData/ModelCoders.swift:1762: Fatal error: Passed nil for a non-optional keypath
I updated today at Xcode 16 beta 6, and my app using SwiftData on iOS 18 (beta 6) is getting now this new error when saving the model in the modelContext. I don't understand if it is a regression introduced in the beta 6 or if it is enforced something that previously wasn't. It seems to be always referred to the ID property, for example: SwiftData/ModelCoders.swift:1762: Fatal error: Passed nil for a non-optional keypath \MyModel.id In this case (and in most of the cases in my models) the ID is defined as following @Attribute(.unique) public var id: UUID I also tried to add the initialization inline, but didn't help @Attribute(.unique) public var id: UUID = .init() I also tried to remove the @Attribute(.unique), didn't help as well. Does any of you have the same issue?
7
3
1.6k
Nov ’24
Updating Swift Packages via command line (Xcode 16)
We have a tool in our CI which periodically updates our iOS project's Swift Package Manager dependencies. The script that does a few things, but generally speaking it first removes the existing package.resolved at ./ProjectName.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved and then runs: xcodebuild -resolvePackageDependencies -disablePackageRepositoryCache This regenerated the package.resolved file to reflect the latest, updated versions of the dependencies. It is the equivalent of doing Xcode > File > Packages> Update to Latest Package Versions. This has been working perfectly for a long time, but has stopped working since we moved from Xcode 15.4 to Xcode 16. I have also tested this with Xcode 16.1 and 16.2 - with no luck. I have tried running this command locally, and can confirm it is not an issue with the environment of our CI. I have also tried swift package update. Both of these commands appear to work - no errors are thrown, and the logs say "resolved source packages". However, they are not updating the packages. They are making no changes to the package.resolved file. However, using Xcode > File > Packages> Update to Latest Package Versions in Xcode 16 works as expected - the packages are updated and the .resolved file is updated. Is there now a different way to update Swift packages via the command line, or is this likely an Xcode 16 bug? Update: This feels broken, so I have submitted a Feedback Report (FB16108036) but perhaps someone can suggest a workaround for the time being!
0
3
842
Dec ’24
Where is swift assist?
Swift assist has been announced by apple this year. I have waited Xcode 16.2 release before posting this because I was still hopping for swift assist this year but apple DIDN'T release swift assist and they haven't post anything about swift assist reported or something... What's going to happen with swift assist? Coming next year?
2
3
1.2k
Feb ’25
WidgetKit keep crashing and widgets not displaying
So I have a MacOS application that was working just fine before Xcode 16. The Widgets are not working anymore. The main application and the widgets share a file in a common App Group. The widget app now get a permission error when accessing the file. Also, the Widget Kit simulator keeps crashing. I also try to start a new project in Xcode, add a target with a Widget extension with an App Intent and run it, and it also crashes. Sometimes, it doesn't crash but just display the error: "Failed to load widget. The operation couldn't be completed. (WidgetKit_Simulator.WidgetDocument.Error error 2.). Edited to attach WidgetKit error log widgetKitError.txt
8
3
1.6k
Feb ’25
Can't get Account information with XCode 16.1
I’m trying to add my account to Xcode 16.1, which is running on a virtual machine with macOS Sequoia 15.1. I was able to successfully sign in to my account on the virtual machine itself. I’m using a Mac Mini M2, but when I attempt to add my account in Xcode, I encounter the following error: "There was a failure decoding response: (HTTP 401, 60 bytes) The data couldn’t be read because it isn’t in the correct format."
0
3
446
Nov ’24
Error when compiling with Xcode 16.2
I'm trying to compile my iPad app with Xcode 16.2 and I'm consistently getting this error message: couldn't find compile unit for the macro table with offset = 0x0 This is happening at the GenerateDSymFile step. I've tried changing the debug format from Dwarf with Dsym to Dwarf and then back again, as I've read there was a problem with generating the dsyms. But the problem persists. I've tried searching for this error and found nothing online, so apparently I'm the only one! How strange. Are there any settings or flags I can change to try to get more information about what's going wrong?
4
3
1.3k
Feb ’25
iOS app fails to run with Xcode 16, no issue with Xcode 15 (no build errors)
When I build and run my iOS app with Xcode 16.0 RC (16A242), it fails to run on both a physical iPhone (running iOS 18.0) and any iOS simulator (17.5, 18.0 RC tested). To be clear, this is an issue when running – there are zero build errors, and compilation always completes successfully. The same app, building and running from Xcode 15.4 (15F31d) runs on both a physical iPhone (same OS version) and an iOS simulator (same version) with no issues, and is currently deployed to TestFlight with no crashes at launch reported from users. Xcode 16's console logs the following: warning: (arm64) /Users/seb/Library/Developer/Xcode/DerivedData/Feed-bvzobcgzcnaibqbcwiasvpoxsetu/Build/Products/Debug-iphonesimulator/Feed.app/Feed empty dSYM file detected, dSYM was created with an executable with no debug info. No entry point found. Checked '(null)' I've so far tried a clean build, as well as clearing out my derived data folder entirely. Happy to provide any more info. Does anyone have any pointers as where I even start to debug this issue and narrow down on what's going on with Xcode 16?
12
3
12k
Sep ’24
Unable to find a destination matching the provided destination specifier
Hello community! Recently I faced unusual problem when I'm trying to run UITest from commandline. Everything works from XCode (I can execute UITest on both simulator and device), but in console I'm always getting: xcodebuild: error: Unable to find a destination matching the provided destination specifier: { platform:iOS Simulator, OS:17.5, name:iPhone 15 Pro } I already checked lot of possible solutions but none worked. What seems to be important here, I don't have any "Available destinations" proposal. Also installed XCode version is 16, but I need to run this project on 15.4 which is in another folder (I used xcode-select to choose 15.4, also tried to execute xcodebuild using full path) . Executing: xcrun simctl list shows me f.e.: -- iOS 17.5 -- iPhone 13 Pro (D20DE861-B938-4FD3-9797-F0AE0BBA5569) (Shutdown) iPhone 15 (FE8687E4-B7CD-4861-83F8-B9E833F14982) (Shutdown) iPhone 15 Plus (4B1F46CC-7C95-496B-9776-EC6BC539199E) (Shutdown) iPhone 15 Pro (C622866E-74C8-45F5-A7B0-DFA76BC7C452) (Booted) iPhone 15 Pro Max (CEF3892C-CFD4-4558-A317-A6EBDB079AAF) (Shutdown) but running: xcodebuild -workspace ./***.xcworkspace -scheme xxxUITests -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5' build brings same error. What is also interesting, I'm getting same error when trying to run same command in GitLab pipeline. Is there anyone who had same problem?
1
3
631
Nov ’24
Xcode 16 Doesn't Display "Swift Compiler" Build Settings Sections
I am editing my iOS project in Xcode 16 and want to use the "Swift Compiler - Upcoming Features" section of the build settings to selectively enable the new Swift 6 language features. I have read the instructions for doing this and have dowloaded an Apple sample project and can see that section under the project and target-level Build Settings in the sample project However, when I open my Xcode project in XCode 16 that section does not appear. Is there any way for me to influence how Xcode 16 displays the build settings? In fact, no "Swift Compiler" sections appear at all under my project Build Settings (All | Combined). There is a "User-Defined" section that has the Swift Version, Compilation Mode and Optimization level. The project itself is several years old and was on a very old project version. I have upgraded my project document format to "Xcode 16" but it made no difference. I have compared my project and the sample project in a text editor and both seem to have similar structure. I tried removing unused and outdated settings from my project but that also had no effect. Is there an alternative to deleting my project file and adding the source files to it? I have a large project with multiple targets so that would be something I'd rather not do.
3
3
952
Jan ’25
Under Xcode 26 beta 3, how to support new glass icons for iOS 26 and old icons for iOS 18?
I know there are several existing threads on this topic but things keep changing. The release notes for Xcode 26 beta 3 have the following statements for a couple of resolved issues: Asset Catalog Fixed: Unable to set Icon Composer icon as alternate iOS icon (153305178) (FB18025356) Icon Composer Fixed: Icon Composer icons back deploy to older versions of iOS, macOS, and watchOS with inconsistent rendering. (152258860) I had a working solution under beta 1 and beta 2 for both of these. But under beta 3, I am now seeing the new glass icons for my app when running on a simulated iOS 18 device. This is happening for both the main app icon and any alternates. This contradicts the statement that beta 3 fixes this issue. There is no documentation (that I can find) describing how you are supposed to support old icons for iOS 18 and new glass icons for iOS 26. There is no documentation for how to support alternate glass icons for iOS 26. What I'm doing at the moment (that worked before beta 3) was to have the normal iOS 18 app icons in the Asset catalog and to have the new glass icons added to the project. The filenames for the glass .icon files have the same name as the app icons in the Assets catalog. This worked under beta 1 and beta 2. And despite the Xcode 26 beta 3 release notes stating that Icon Composer icons no longer back deploy to iOS 18, I'm seeing the opposite. Beta 3 now does the opposite of that statement. Does anyone have a working solution that supports old iOS 18 app icons and new iOS 26 glass icons using Xcode 26 beta 3? Note, all of my testing is with simulated iOS devices and I'm running Xcode 26 beta 3 under macOS 15.5. Maybe that's an issue?
2
3
243
Jul ’25
Xcode 16 and iOS 18 project not compiling
I updated Xcode and MacOS recently and haven't been able to compile my Flutter app on iOS devices/simulators since then. The error keeps changing every time I run it but here's one of the output in the terminal after running flutter run: Uncategorized (Xcode): Command SwiftGeneratePch emitted errors but did not return a nonzero exit code to indicate failure Error (Xcode): no such file or directory: '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation' Error (Xcode): stat cache file '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.0-22A3362- db63dc9361471f152f572502bdbfe70a.sdkstatcache' not found Error (Xcode): unable to rename temporary '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3F9VRK3CXAUUD/UIKit-1KHQ7M05IF VXC-56601391.pcm.tmp' to output file '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/3F9VRK3CXAUUD/UIKit-1KHQ7M05IF VXC.pcm': 'No such file or directory' Error (Xcode): could not build module 'UIKit' /Users/chiragbhansali/Chirag/Coding/Projects/app/test/build/ios/Debug-iphonesimulator/Flutter.framewo rk/Headers/FlutterAppDelegate.h:7:8 Error (Xcode): could not build module 'Flutter' /Users/chiragbhansali/Chirag/Coding/Projects/app/test/ios/Runner/GeneratedPluginRegistrant.h:9:8 Error (Xcode): failed to emit precompiled header '/Users/chiragbhansali/Library/Developer/Xcode/DerivedData/Runner-eifcguceazlwumgsyzegclqdrbqt/Build/Intermed iates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_PB6A5GFLTNPC-clang_3F9VRK3CXAUUD.pch' for bridging header '/Users/chiragbhansali/Chirag/Coding/Projects/app/test/ios/Runner/Runner-Bridging-Header.h' Uncategorized (Xcode): Command PrecompileSwiftBridgingHeader emitted errors but did not return a nonzero exit code to indicate failure Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code Could not build the application for the simulator. Error launching application on iPhone 16 Pro. What I have tried so far: Deleting iOS SDK and simulators Cleaning Xcode build cache using cmd+shift+k Creating a new Flutter project and trying to compile it (it failed so that reduces the chances of it being a Flutter issue) Clearing the DerivedData folder Clearing settings and cache of simulators Restarting laptop Versions: Xcode: 16.0 iOS: 18.0 MacOS: 15.1 (didn't work with 15.0 either) Flutter: 3.24
22
3
16k
Mar ’25
xcodebuild fails to build target that links AppIntents.framework once SWIFT_EXEC is specified
Reasoning I am working on a tool that does swift code preprocessing, which is done by a custom script that gets passed as SWIFT_EXEC. This script does some magic and then calls the original swift compiler from /usr/bin/swiftc. I am facing a rather non-common issue. Problem With the release of Xcode 16, for some reason xcodebuild now forcibly does not supply --compile-time-extraction flag to the appintentsmetadataprocessor, if xcodebuild also has a SWIFT_EXEC= argument. (appintentsmetadataprocessor is a tool that is executed automatically by the xcode build system if the app is using App Intents feature). Xcode 15 behaves fine in this regard and always passes --compile-time-extraction flag to appintentsmetadataprocessor (both with or without SWIFT_EXEC). But when the --compile-time-extraction flag is not passed, the appintentsmetadataprocessor fails with an error, making xcodebuild fail as well, essentially making AppIntents unavailable if SWIFT_EXEC build setting is used. Here's how to reproduce the issue: Create a new iOS Xcode project, add AppIntents.framework to the list of linked frameworks, and run xcodebuild SWIFT_EXEC=/usr/bin/swiftc from the project directory. If you're using Xcode 16 you will get a build error: starting appintentsmetadataprocessor export error: At least one halting error produced during export. No AppIntents metadata have been exported and this target is not usable with AppIntents until errors are resolved. error: The operation couldn't be completed. (GeneratorBuildProductExtractor.BinaryScanningError 6.) Alternatively, instead of running xcodebuild, one can add user-defined build setting SWIFT_EXEC=/usr/bin/swiftc to the xcode project target's build settings and build it from xcode, getting the same build failure error. Question The question I am hoping to get an answer or a hint to, is is there any kind of a workaround that would force appintentsmetadataprocessor to still get the --compile-time-extraction argument, when it is launched by the xcodebuild, so the build process completes sucessfully? I also tried passing LM_COMPILE_TIME_EXTRACTION=YES to the xcodebuild, which, according to /Applications/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/PlugIns/XCBBuildService.bundle/Contents/PlugIns/XCBSpecifications.ideplugin/Contents/Resources/AppIntentsMetadata.xcspec, should enable --compile-time-extraction, however this setting seems to be either ignored or overridden once the SWIFT_EXEC is passed, making it useless. Can this option be injected/enforced? The corresponding issue tracking number is FB15274300 Thank you
0
3
764
Oct ’24
Unable to reset simulators
I'm unable to reset simulators using the menu or the xcrun simctl tool: <output of xcrun simctl list> == Devices == -- iOS 17.5 -- iPhone SE (3rd generation) (5A06623A-173D-4C96-8DD3-3E9FE39A06F1) (Shutdown) iPhone 15 (iOS 17.5) (F4329E8D-29BB-4EA7-8465-C11A98D04ED7) (Shutdown) -- iOS 18.0 -- iPhone SE (3rd generation) (2DDE8F03-F8E1-4C1B-8E28-CD9B208F3FFA) (Shutdown) iPhone 16 Pro (DE788688-8AC6-40A0-B25C-A56AA423798E) (Shutdown) iPhone 16 Pro Max (1405184C-36A9-40F3-B0D0-4EEB88452883) (Shutdown) iPhone 16 (0CBBA7DB-B20E-4F17-BBC5-910F1F6E1A0A) (Shutdown) iPhone 16 Plus (95421C27-11A0-4FCF-A889-DAAE8557B271) (Shutdown) == Device Pairs == ~/Library`` ❯ xcrun simctl erase 0CBBA7DB-B20E-4F17-BBC5-910F1F6E1A0A An error was encountered processing the command (domain=NSCocoaErrorDomain, code=513): “data” couldn’t be moved because you don’t have permission to access “Deleting-8FEDFF47-5B2F-4534-BCA2-036BBE68CE37”. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info. Underlying error (domain=NSPOSIXErrorDomain, code=1): The operation couldn’t be completed. Operation not permitted Operation not permitted Xcode Version 16.0 (16A242d) MacOS 15.0.1 (24A348)
3
3
1.6k
Jan ’25
Black text on white button on iOS 18 Accented Home Screen Widget
Hi. I am making my widgets ready for iOS 18 accented Home Screen widgets. I am having issues setting the color of text to black. This is required as I have a white button with black text and black icon. I have tried manually, without using my Color, to set the text to .black or .white. It will always be white. When applying the accent, I can use the .widgetAccentedRenderingMode(.fullColor) to turn the icon black, but I cannot do this for the text. Button(intent: --intent--) { HStack(alignment: .center) { Text("Play") .font(.system(size: 12, weight: .bold)) .foregroundStyle(Color("buttonAccentColor")) // Problem here, this is forced to be white, I want it to be black Image("resume") .renderingMode(.template) .resizable() .widgetAccentedRenderingMode(.fullColor) // This works .aspectRatio(contentMode: .fit) .frame(width: 16, height: 16) .foregroundStyle(Color("buttonAccentColor")) } .padding(8) .padding(.horizontal, 8) } .buttonStyle(.plain) .background(Color("neutral100")) .clipShape(Capsule())
1
3
491
Oct ’24