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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Xcode 16 simulator slow to load - unusable
I'm on version 16 of simulator and Xcode. Last Friday, starting the simulator would take 10 seconds at the most. Now, it takes at least 10 minutes. My app target is the same and nothing in my app itself has changed. There's no new software installed and it has plenty of RAM and disk. When I target my phone, it is instant. So I'm testing / debugging everything on my phone now. When I use the simulator, the initial load is about 10 minutes, then it's fine (using the app itself). But something is causing it to hang when loading. And like I said - last week it was fine. If it was slow when running on my phone, I'd think it was something with me/the app. But it's not. This is the only messages I get in the system log. Feb 24 12:54:46 MacBookAir bootlog[0]: BOOT_TIME 1740423286 329039 Feb 24 13:06:42 MacBookAir syslogd[2095]: Configuration Notice: ASL Module "com.apple.contacts.ContactsAutocomplete" claims selected messages. Those messages may not appear in standard system log files or in the ASL database. Feb 24 15:10:13 MacBookAir syslogd[8045]: --- syslogd restarted --- Feb 24 15:10:13 MacBookAir syslogd[8045]: Configuration Notice: ASL Module "com.apple.contacts.ContactsAutocomplete" claims selected messages. Those messages may not appear in standard system log files or in the ASL database.
2
0
446
Mar ’25
Value column missing for Info.plist
Here's what my Info.plist looks like: The problem here is that there is no value column. No where for me to edit the values. It's driving me insane. I can edit in a vanilla text editor, but it's annoying to use the auto complete feature here and then open a text editor to change the value. Anyone know why this could be happening? Am I just missing a setting toggle somewhere?
4
0
115
Mar ’25
Invalid binary for tvOS app which integrates an xcframework
We're building an SDK (let's call it MyFramework) which is distributed as an .xcframework for developers to integrate it into their own apps. Recently, we've added tvOS support by adding it as a supported destination for the SDK. Essentially, the SDK became a cross-platform framework and easy to be adopted in both iOS and tvOS apps. The .xcframework is generated fine, all builds correctly. We've tested the SDK integrated in test apps. We've also submitted an iOS archive app to the AppStore connect, just to make sure all is well with the AppStore submission. However, when I tried submitting a tvOS archive app (that integrates the same SDK) to the AppStore connect, the build was marked as invalid binary and we've got the following error message: ITMS-90562: Invalid Bundle - One of the nested bundles is built for a platform which is different from the main bundle platform. Please make sure that all bundles have correct platform specification. First, I thought that any of the modules of the framework was not correctly configured for tvOS but that was not the case. Everything compiles ok and it runs in debug as expected. It only fails when trying to submit the tvOS app that integrates the SDK. After a lot of investigating, we realised that the reason for the AppStore submission error is because we codesign the framework. We use codesign to distribute it as cryptographically signed xcframework. codesign --timestamp -v --sign "Apple Distribution: Company (xxxxxxxxxx)" "MyFramework.xcframework" As soon as we remove the above line from our CI/CD pipeline that generates the xcframework, and submit a tvOS archive app that integrates the unsigned framework, the AppStore submission error goes away and the TestFlight build can be tested. I've also tried to just strip the _CodeSignature folder from the .xcframework package but it still fails. So the only solution currently is to not codesign the xcframework to be able to upload tvOS archive apps that integrate the SDK to the AppStore connect. However, we're still puzzled as to why only the tvOS archive app gets the invalid binary error when it integrates a signed SDK. I feel like the error message is quite misleading if we have to stop signing the SDK xcframework for it to be accepted during the AppStore submission. Anyone has any idea? Or has anyone encountered a similar issue? Thanks!
0
0
199
Mar ’25
Active Compilation Conditions in Packages
The flags like #if DEBUG ... endif are dependent on the Active Compilation Conditions. So if they say DEBUG the enclosed code block will be executed, otherwise not. Now I have the phenomenon that a #DEBUG block in a Package does not evaluate these conditions. It rather depends on the name of the configuration used to build. So if I build my app with Active Compilation Condition set to DEBUG, but the configuration name is something like App-Release, the DEBUG block in my Package is not added/executed. The ones which are directly in the project are added. Vice versa if the Compilation Condition say RELEASE but the configuration is called App-Debug the blocks in the Package are added to the compilation, but the ones in the project itself are not It suffices that the config name contains the word Debug for this to happen. E.g. the configuration App-Release-Debug (I know that this would be stupid, but it is for demonstrating purposes) will cause the Packages to include the DEBUG blocks. This happens no matter what you set in the Build Settings of the project and/or target. The Packages are added via GitHub/GitLab Source Control with SPM. Any ideas why this behaves like it does? It doesn't seem like it should...
0
1
110
Mar ’25
Watch: WCSession is NOT reachable
** Facing issue for watch unreachable, I have tried for real device as well simulator** if let controller = window?.rootViewController as? FlutterViewController { let channel = FlutterMethodChannel( name: "watchconnectivity", binaryMessenger: controller.binaryMessenger) channel.setMethodCallHandler({ [weak self] (call, result) in switch call.method { case "sendToWatch": guard let watchSession = self?.session else { print("❌ Watch session not initialized") result(false) return } guard watchSession.isPaired else { print("❌ Watch not paired") result(false) return } guard watchSession.isReachable else { print("❌") print("isPaired: \(watchSession.isPaired)") print("isWatchAppInstalled: \(watchSession.isWatchAppInstalled)") print("isComplicationEnabled: \(watchSession.isComplicationEnabled)") result(false) return } guard let arguments = call.arguments as? [String: Any] else { print("❌ Invalid arguments format") result(false) return } if watchSession.isWatchAppInstalled { try? watchSession.updateApplicationContext(["forceLaunch": true]) } print("📤 Sending message to Watch: \(arguments)") watchSession.sendMessage(arguments, replyHandler: { response in print("✅ Message sent successfully") result(true) }, errorHandler: nil ) default: result(FlutterMethodNotImplemented) } }) }
1
0
261
Mar ’25
Xcode 15/16: Copy (cmd+C) doesn’t work reliably when paused at a breakpoint
I’ve been running into an annoying issue for a while now and wondering if anyone else can confirm or suggest a fix. When Xcode hits a breakpoint (i.e., the app is paused), I often need to copy some text from the source code using cmd+C — for example, to paste into the debugger and inspect a variable or object. However, most of the time, the copy operation fails and nothing ends up on the clipboard. I have to repeat the copy action multiple times before it works. This doesn’t happen 100% of the time, but it’s frequent — maybe around 7 out of 10 attempts fail. I’ve been noticing this behavior since around Xcode 15. Has anyone else experienced this? Is there a known workaround or fix?
2
0
79
Mar ’25
The developer disk image could not be mounted on this device. IPhone 16e Xcode 16.2
I'm having trouble with Xcode 16.2 when trying to pair or upload apps to my iPhone 16e running iOS 18.3. Interestingly, it works perfectly with older models like the iPhone 15 and 14, even though they’re on the same iOS version. When I attempt to install an app on my iPhone 16e via Xcode, I encounter this error: The developer disk image could not be mounted on this device. (com.apple.dt. CoreDeviceError error 12040 (0x2F08)) DDIPath = /Library/Developer/DeveloperDiskImages/iOS_DDI. dmg DeviceIdentifier = 42E4BEC2-3B1E -4903-9A29-CC5C6363F677 Options = { MountedBundlePath = "file:///private/var/tmp/CoreDevice_DDI_Staging_501/42E4BEC2-3B1-4903-9A29-CC5C6363F677/*; UseCredentials = 0; } NSURL = file:///Library/Developer/DeveloperDiskImages/iOS_DDI.dmg ERROR: Error mounting image: 0x800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.) (com. apple,mobiledevice error -402652913 (OxE800010F)) FunctionName = AMDeviceRemoteMountPersonalizedBundle LineNumber = 2145 ERROR: Failed to initialize image properties: 0x800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.) (com. apple.mobiledevice error -402652913 (0x800010F)) FunctionName = -[PersonalizedImage mountImage:] LineNumber = 1816 ERROR: Failed to find image for variant/identity: (variant: DeveloperDiskImage | boardID: 4 | chipID: 33088 | securityDomain: 1). (com.apple.mobiledevice error -402652913 (0xE800010F)) FunctionName = -[PersonalizedImage initializeImageProperties:] LineNumber = 1063
2
0
471
Mar ’25
The Xcode account often logs out automatically when I use fastlane.
I used fastlane to package and upload the test package to TestFlight. However, the account in Xcode is often logged out automatically without any prompts. In Xcode, I logged in with the developer account to automatically manage certificates, provisioning profiles, signatures, etc. For the fastlane upload, I used a Application-specific passwords. Does anyone know what could be the reason? I'm almost driven crazy.
1
0
89
Mar ’25
How to use xcframework in SwiftPackage and statically link it into iOS product
I want to statically link xcframework as binaryTarget in Swift Package, but it is copied into the product as dynamic when the Xcode build. How to use xcframework in SwiftPackage and statically link it into iOS product? The Package.swift content and the project are: The WebP.xcframework is static: The Xcode Build Product's WebP.framework is dynamic:
0
0
95
Apr ’25
Updated Deeplink is not working
Hello, We are facing deeplink related issue for our production app. In our finding, we got to know that issue is related to apple CDN caching, We have did the changes at our server level but still it is navigating to previous URL. Earlier deeplink was "https://bobcard.bobfinancial.com/dl" now it is changed to "https://linkdeep.bobcard.co.in/mapp". Please check and update this new one in apple cdn cache. For the new link it is redirecting to App store instead of App. Below are the link through which we have tested deeplink scenario: "https://app-site-association.cdn-apple.com/a/v1/bobcard.bobfinancial.com" working fine. "https://app-site-association.cdn-apple.com/a/v1/linkdeep.bobcard.co.in" it is throwing not found error.
1
0
88
Apr ’25
Xcode fails to attach to process when building to the Simulator
When trying to build and run our iOS app on the simulator we're hitting the following error: Could not attach to pid: "XXXXX" failed to get reply to handshake packet within timeout of 6.0 seconds I've included some more details on our project/setup below: We're working on a large project with multiple schemes / app targets. The error only affects one of our targets - however the dependencies between the problematic target and the others are very similar. The issue only affects building to the simulator; building to a physical device works fine. Scheme configuration is the same across all targets. We've faced this issue on multiple versions of Xcode, from 15.x through to the latest 16.3 RC. We've tried a number of workarounds, some of which work intermittently for some colleagues - but none of which have provided a durable solution. These include varying combinations of: Setting the IDEPreferLogStreaming=YES environment variable Unchecking Debug Executable under Edit Scheme -> Run Manually launching the app on the Simulator and then attaching the debugger using Debug -> Attach in Xcode Erasing all contents and settings on the simulator (this sometimes fixes things for a single build, but we run into the same issue again for all subsequent builds, and it doesn't work for all developers). Clearing out Derived Data and running a clean build (this doesn't seem to help). We'd really appreciate any input on how we can diagnose what's causing this issue or any suggested steps to help resolve it.
4
1
293
Apr ’25
XCODE Preview: XOJITError: Could not create code file directory for session: Permission denied
I keep running into the following issue when trying to run preview for my application in Xcode. FailedToLaunchAppError: Failed to launch app.a /Users/me/Library/Developer/Xcode/DerivedData/a-aloudjuytoewlldqjfxshbjydjeh/Build/Products/Debug/a.app ================================== | [Remote] JITError | | ================================== | | | [Remote] XOJITError | | | | XOJITError: Could not create code file directory for session: Permission denied`
3
0
194
Apr ’25
Why are .symbols files missing in the Symbols folder in ipa file when building with Xcode 16.1?
Hi, I'm encountering an issue with the .symbols files when building iOS and generating ipa file with Xcode 15.4 vs Xcode 16.1. I built my iOS project and generated an ipa file using Xcode 15.4. After I unzipped the ipa, there are around 10 .symbols files in the Symbols folder. One of them is about 20MB and others are under 1MB. However, when I built and generated the ipa with the newer Xcode 16.1, after unzip, there are no .symbols files in the Symbols folder. Could anyone explain why this happened? Is there a new setting or behavior in Xcode 16.1 that affects the generation of .symbols files? I think the .symbols files are needed for analyzing crash reports and symbolication, and I’m unsure why they aren’t present in the build generated with Xcode 16.1. Any help would be greatly appreciated! Thanks in advance.
4
0
181
Apr ’25
SortDescriptor from a generic method crashes Xcode Previews but not Simulator.
I attempted to create a SortDescriptor using a method in enum to sort various different models in SwiftUI lists. But it causes crashes in Xcodes previews but not in the simulator, and I don't know why. Maybe someone could suggest changes. extension Item:ListSorting {} //List sorting is a protocol given to various Models enum ListSortingStyle<T>:String,CaseIterable where T:ListSorting { case alphabetical = "A…Z" case alphabeticalReverse = "Z…A" case createDate = "Newest" case createDateReverse = "Oldest" case editDate = "Latest Edit" case editDateReverse = "Oldest Edit" /// Returns a SortDescriptor matching the enumeration func sortDescriptor() -> SortDescriptor<T> { switch self { case .alphabetical: SortDescriptor<T>(\.name, comparator: .localized, order: .forward) case .alphabeticalReverse: SortDescriptor<T>(\.name, comparator: .localized, order: .reverse) case .createDate: SortDescriptor<T>(\.creationDate, order: .forward) case .createDateReverse: SortDescriptor<T>(\.creationDate, order: .reverse) case .editDate: SortDescriptor<T>(\.editDate, order: .forward) case .editDateReverse: SortDescriptor<T>(\.editDate, order: .reverse) } } } Which is used in struct ItemsList: View { @Environment(\.modelContext) private var modelContext @Query private var items:[Item] = [] init(sortStyle:ListSortingStyle<Item> = .alphabetical) { let sortDescriptor = SortDescriptor<Item>(\.name, comparator: .localized, order: .forward) //(1) This works in preview & simulator //OR let sortDescriptor2 = sortStyle.sortDescriptor() //(2) This crashes in a preview when used in a fetch not in the iOS simulator print(sortDescriptor,sortDescriptor2) let descriptor = FetchDescriptor<Item>(sortBy:[sortDescriptor2]) self._items = Query(descriptor) } var body: some View { ... } } As far as I can see both methods create a SortDiscriptor. If I print the sortDescriptor variable in they look almost identical: //1 SortDescriptor<Item>( order: Foundation.SortOrder.forward, keyString: nil, comparison: Foundation.SortDescriptor<MyApp.Item>.AllowedComparison.comparableString( (extension in Foundation):Swift.String.StandardComparator(options: __C.NSStringCompareOptions(rawValue: 0), isLocalized: true, order: Foundation.SortOrder.forward), \Item. <computed 0x0000000340213b18 (String)>) ) //2 SortDescriptor<Item>( order: Foundation.SortOrder.forward, keyString: nil, comparison: Foundation.SortDescriptor<MyApp.Item>.AllowedComparison.comparableString( (extension in Foundation):Swift.String.StandardComparator(options: __C.NSStringCompareOptions(rawValue: 0), isLocalized: true, order: Foundation.SortOrder.forward), \Item.<computed 0x0000000340022174 (String)>) ) But the one created with the generic method on the enum crashes with the error message: CrashReportError: Fatal Error in DataUtilities.swift MyApp crashed due to fatalError in DataUtilities.swift at line 64. Couldn't find \Item.<computed 0x0000000340022174 (String)> on Item with fields [SwiftData.Schema.PropertyMetadata ...
3
0
151
Apr ’25