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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Call Tracking with CallKit Works in Debug Mode but Not in Release (TestFlight) – iOS
I am working on an iOS app using Flutter that tracks outgoing calls using CallKit. The call tracking functionality works perfectly in Debug mode but does not work when the app is published to TestFlight. I have already added Background Modes (voip, audio, processing, fetch) in Info.plist. I have added CallKit.framework in Xcode under Link Binary With Libraries (set to Optional). <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>aps-environment</key> <string>production</string> </dict> </plist> These are the necessary permission which I used in info.plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BGTaskSchedulerPermittedIdentifiers</key> <array> <string>com.agent.mygenie</string> </array> <key>CADisableMinimumFrameDurationOnPhone</key> <true/> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDisplayName</key> <string>MyGenie</string> <key>CFBundleDocumentTypes</key> <array/> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>mygenie</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>$(FLUTTER_BUILD_NAME)</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>$(FLUTTER_BUILD_NUMBER)</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSCallKitUsageDescription</key> <string>This app needs access to CallKit for call handling</string> <key>NSContactsUsageDescription</key> <string>This app needs access to your contacts for calls</string> <key>NSMicrophoneUsageDescription</key> <string>This app needs access to microphone for calls</string> <key>NSPhotoLibraryUsageDescription</key> <string>This app needs access to photo library for profile picture updation</string> <key>UIApplicationSupportsIndirectInputEvents</key> <true/> <key>UIBackgroundModes</key> <array> <string>voip</string> <string>processing</string> <string>fetch</string> <string>audio</string> </array> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIMainStoryboardFile</key> <string>Main</string> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> [code.txt](https://developer.apple.com/forums/content/attachment/0a327dbd-652e-41d5-8811-c462d09e0567) </dict> </plist> And below is the file are AppDelegate.swift, call_tracking_mixin.dart, & main_call.dart file for full knowledge
0
0
111
Mar ’25
Integrating binary inside Framework via SPM
So I will summary an issue one of our clients has asked us on GitHub: https://github.com/pendo-io/pendo-mobile-sdk/issues/233 Project that is a custom framework that uses different SPM packages (one of them is Binary package), we have our main logic inside that framework and we have different targets that use this framework, everything works on the simulator, but running the app on the actual device provokes a crash saying "Binary framework was not found". We have like 20 other SPM packages that work fine, this is the first one we have an issue with. Please note I understand that SPM will not copy paste the Binary for the magic framework as it does for the apps so I suggested to embed it manually. So my question is what the best(easy) way to do it. Please refer to the following issue for more details: https://github.com/pendo-io/pendo-mobile-sdk/issues/233
0
0
80
Mar ’25
Stale Issues, refreshAllObjects() is not working
Hi Experts, Could you please help. Issue at high level: After Editing a View contains a Table entries, saved and hit back button to display View, Table entries are duplicated or displaying previous and current entries together. Here is my Issue in detailed. List view display, clicking on any row, would navigate to DisplayView of a record. I am displaying a table in DisplayView. DisplayView contains "row" as parameter, and it must be initialized in "init" method, where I use row.key and fetch another table (say ColorTab) using Color.Key. DisplayView contains "NavigationView", with Edit button. it displays fetched Colors. example Red and Green. when user click on Edit, it takes to EditPage. user can remove / add colors. Once user made changes, saved and hit back button. Table entries are duplicated or showing previous and current entries. Options tried, a) init method is only triggering 1st time, not triggering when back button clicked, I failed to use FetchRequest outside of init method, I tried on OnAppear too. i didn't trigger. b) Failed to use FetchRequest inside of var Body too. c) tried using viewContext.refreshAllObjects() .. it is not refreshing the table. Could you please help if there is solution for the issue. Thanks, Bhanu
0
0
76
May ’25
NSE Filtering Entitlement Rejected Repeatedly – Seeking Advice & Possible Solutions
Hi everyone, I’m facing a major roadblock with my family location tracking app, and I need some advice or guidance from the community. Background Back in 2021, I implemented NSE filtering entitlement to send location-based notifications and retrieve the device's location in return (as suggested by Apple’s technical code support). Over time, I built my app around this entitlement, adding many features that depend on it. When Location Push Service Extension was introduced for iOS 15+, I adapted accordingly: NSE filtering was used for devices below iOS 15 Location Push Service Extension was used for iOS 15+ NSE filtering also played a crucial role in: ✅ Accepting/rejecting location-based notifications ✅ Checking device settings & location permissions (since location push won’t work without proper permissions) The Issue In November 2024, I created a new developer account to change my business entity. Since then, I’ve been requesting the NSE entitlement repeatedly for four months, but Apple keeps rejecting it. Meanwhile, they approved the Location Push Entitlement, but without NSE filtering, I’m forced to rewrite a huge part of my app’s core functionality. I’ve sent multiple emails explaining my use case, but I keep getting rejected without any clear explanation or workaround. My Ask Has anyone faced a similar issue with NSE entitlement? Are there any alternative approaches to achieve the same functionality? Any advice on how to escalate this to Apple or get proper feedback on why it's being rejected? I’ve invested years into this app, and a forced rewrite would take months. Any help, insights, or contacts who could assist would be greatly appreciated! Thanks in advance! 🙏
0
0
60
Mar ’25
The behavior of the app using the Promises library changes between Xcode 15.4 and Xcode 16.2.
I’m creating code that performs asynchronous processing using the Promises library (https://github.com/google/promises). In this context, when building the app in Xcode 15.4 and Xcode 16.2, the behavior differs between the two. I’m using version 2.1.1 of the library. Also, I’ve tried using the latest version, 2.4.0, but the result was the same. Has anyone encountered the same issue or know an effective solution? Here's a simple code that reproduces this issue. @IBAction func tapButton(_: UIButton) { _ = getInfo() } func getInfo() -> Promise<Void> { Promise(on: .global(qos: .background)) { fulfill, _ in self.callApi() .then { apiResult -> Promise<ApiResult> in print("\(#function), first apiResult: \(apiResult)") return self.callApi() // #1 } .then { apiResult in print("\(#function), second apiResult: \(apiResult)") // #2 fulfill(()) } } } func callApi() -> Promise<ApiResult> { Promise(on: .global(qos: .background)) { fulfill, _ in print("\(#function), start") self.wait(3) .then { _ in let apiResult = ApiResult(message: "success") print("\(#function), end") fulfill(apiResult) } } } struct ApiResult: Codable { var message: String enum CodingKeys: String, CodingKey { case message } } The Swift Language version in the build settings is 5.0. The console output when running the above code is as follows: When built with Xcode 15.4: 2025/03/21 10:10:46.248 callApi(), start 2025/03/21 10:10:46.248 wait 3.0 sec 2025/03/21 10:10:49.515 callApi(), end 2025/03/21 10:10:49.535 getDeviceInfo(), first apiResult: ApiResult(message: "success") 2025/03/21 10:10:49.535 callApi(), start 2025/03/21 10:10:49.536 wait 3.0 sec 2025/03/21 10:10:52.831 callApi(), end 2025/03/21 10:10:52.832 getDeviceInfo(), second apiResult: ApiResult(message: "success") The process proceeds from #1 to #2 after completing the code comment in #1. When built with Xcode 16.2: 2025/03/21 09:45:33.399 callApi(), start 2025/03/21 09:45:33.400 wait 3.0 sec 2025/03/21 09:45:36.648 callApi(), end 2025/03/21 09:45:36.666 getDeviceInfo(), first apiResult: ApiResult(message: "success") 2025/03/21 09:45:36.666 callApi(), start 2025/03/21 09:45:36.666 wait 3.0 sec 2025/03/21 09:45:36.677 getDeviceInfo(), second apiResult: Pending: ApiResult 2025/03/21 09:45:39.933 callApi(), end The process does not wait for the code comment in #1 to finish and outputs the #2 print statement first. Additionally, even with Xcode 16.2, when changing the #2 line to "print("(#function), second apiResult: (apiResult.message)")", the output becomes as follows. From this, it seems that referencing the ApiResult type, which is not a String, might have some effect on the behavior. 2025/03/21 10:05:42.129 callApi(), start 2025/03/21 10:05:42.131 wait 3.0 sec 2025/03/21 10:05:45.419 callApi(), end 2025/03/21 10:05:45.437 getDeviceInfo(), first apiResult: ApiResult(message: "success") 2025/03/21 10:05:45.437 callApi(), start 2025/03/21 10:05:45.437 wait 3.0 sec 2025/03/21 10:05:48.706 callApi(), end 2025/03/21 10:05:48.707 getDeviceInfo(), second apiResult: success Thank you in advance
0
0
155
Mar ’25
How to make RealityKit both parent and child entities accessible to UI tests?
I have a SwiftUI RealityKit app, and I am writing UI tests for it. The app has entities that have children. All entities have an accessibilityComponent so that they can be found by UI tests. If I set isAccessibilityElement = true for the parent, the UI tests find the parent. If I set isAccessibilityElement = false for the parent, and isAccessibilityElement = true for the child, the UI tests find the child. If I set isAccessibilityElement = true for the parent as well as for the child, the UI tests find only the parent. How can I make parent and child entities both be accessible by the UI tests?
0
0
284
Feb ’25
Xcode 16 Automatically Builds & Runs Simulator While Editing Storyboard
I’m experiencing an issue in Xcode 16 where the app randomly builds and runs in the simulator while I’m designing items in the storyboard. Here’s what I’ve tried so far to stop this behavior: Disabled "Show Live Issues" in the General settings Removed all key bindings related to Build & Run in the Key Bindings settings Checked for unintentional shortcut triggers, but nothing seems to be causing it Update XCode from 16.1 to 16.2 Delete Derived Data Despite these actions, Xcode still automatically builds and launches the simulator at unexpected times, disrupting my workflow. Is there any setting or hidden configuration that could be causing this? How can I completely prevent Xcode from running the simulator automatically while editing UI in the storyboard? Would really appreciate any guidance on this!
0
0
99
Mar ’25
Shared dependencies between test and production code creates library duplication
When test support code relies on production code, a diamond can occur. If this occurs across packages, it can lead to duplicated symbols and incorrect behavior at runtime despite no warnings at build time. This only occurs in Xcode and top-level application testing. This doesn't occur when the code being tested is in a separate package. I'm trying to understand how to correctly manage shared test support code which needs to access production code, or if this is the correct way and it is an Xcode bug. For a minimized example project, see https://github.com/rnapier/SupportCode. The setup includes three packages: Dependencies, which manages all the dependencies for the app and tests; Core which contains core logic and test support; and Feature, which relies on Core an contains feature-related logic and test support. Building this system causes Core.framework to show up three times in DerivedData: ./App.app/PlugIns/AppTests.xctest/Frameworks/Core_59974D35D_PackageProduct.framework ./App.app/Frameworks/Core_59974D35D_PackageProduct.framework ./PackageFrameworks/Core_59974D35D_PackageProduct.framework When unit tests are run, there is a collision on the symbol for Keychain: objc[48914]: Class _TtC8Keychain8Keychain is implemented in both /Users/ornapier/Library/Developer/Xcode/DerivedData/App-grdjljgevqofhqgflgtrqvhvbtej/Build/Products/Debug-iphonesimulator/PackageFrameworks/Core_59974D35D_PackageProduct.framework/Core_59974D35D_PackageProduct (0x100a98118) and /Users/ornapier/Library/Developer/CoreSimulator/Devices/216C441E-4AE5-45EC-8E52-FA42D8562365/data/Containers/Bundle/Application/7197F2F2-EB26-42FF-B7DB-67116159897D/App.app/PlugIns/AppTests.xctest/AppTests (0x1011002c0). One of the two will be used. Which one is undefined. This is not a benign warning. There are two distinct copies of _TtC8Keychain8Keychain and test cases will access one and the app will access a different one. This leads to mismatches when accessing static instances such as .shared. I believe this dependency graph should work, and it does work as long as the top-level testing system is a Swift module. But if it is the application, it builds successfully, but behaves incorrectly in subtle ways.
0
5
518
Feb ’25
Xcode crash reports from TestFlight
My application is in flightTest mode. I received my first two crash reports in XCODE /Organizer. The context is well described, and I was able to isolate the locations where very serious errors occurred. My application is connected. I'm missing one piece of data in this crash report: the time of the crash. This will help me see what (in my case) static data was being read on the data server at that time. This will help me investigate. Is it possible to obtain this information?
0
0
80
Mar ’25
Gathering Required Information for Troubleshooting Xcode Previews or Swift Previews Issues
Hi, You're here because your project has issues related to Xcode Previews or Swift Previews. The issue you're experiencing may be the result of any of the following: An error in your SwiftUI app, Xcode previews, or on-device previews. A configuration error in your Xcode project, including any third-party dependencies or packages. A system issue in the operating system, SwiftUI, or in Xcode Previews. Based on your request, I need more information about your SwiftUI app when rendering Xcode Previews or on-device previews. Specifically, I’ll need the diagnostics Swift Previews generates to make sure I understand the error encountered by the preview system. Please create a report in Feedback Assistant to share the details requested in the instructions below. For issues with macOS, Mac Catalyst, on-device iOS, or on-device visionOS previews, perform the following steps to gather diagnostics: Download and install the Swift Previews logging profile for your device. Reproduce the error while previewing on device, taking note of the timestamp when the error occurred. Attach the Previews diagnostics, sysdiagnose from your Mac, a sysdiagnose from the previewing iOS or visionOS device. For issues with Xcode Previews, perform the following steps to gather diagnostics: Download and install the Swift Previews logging profile for your device. Reproduce the error in Xcode Previews, if you haven’t already done so. If an error banner appears in the canvas, click the "Diagnostics" button within the banner, then go to Step 5; otherwise, continue to Step 4. If the error banner is missing, navigate to the menu in Xcode: Editor > Canvas > Diagnostics In the presented sheet, click the "Generate Report" button. Attach a zip file containing the diagnostic report to your bug report (it will be named something like previews-diagnostics-0123456789.zip). Submitting your feedback Before you submit to Feedback Assistant, please confirm the following information is included in your feedback: with the Swift Previews logging profile installed, attach the sysdiagnose logs gathered after reproducing the issue the Previews diagnostics generated by Xcode timestamp identifying when the issue was reproduced focused sample Xcode project that reproduces the issue (if applicable) screenshots or videos of the error (optional) Please include all requested information to prevent delays in my investigation. After your submission to Feedback Assistant is complete, please respond to your original Forums post with the Feedback ID. Once received, I can begin my investigation and determine if this issue is caused by an error within your SwiftUI app, a configuration issue within your Xcode project, or an underlying issue in the operating system, SwiftUI, in Xcode Previews, or on-device previews. Cheers, Paris X Pinkney |  WWDR | DTS Engineer
0
0
441
Feb ’25
How to setup a directory in Xcode project 16.2
the Xcode Version 16.2 (16C5032a), I want to know how to setup a directory in Xcode project when develop the iOS app. Here is the whole thing: I start a new iOS App project "test_path". then I right click, and choose "New Folder", to make a new folder "configx" then I right click on the configx folder, and choose the "add files to test_path", add a file in it But the folder does not exist in the project when try to access by "Bundle.main.urls" func. 5. when ls in the Mac, /data/Containers/Bundle/Application/E4F11903-3FAD-467F-A4CD-60AC68D64934/test_path.app, the file just at the root path of test_path.app, no "configx" folder ahead the file. so, how to setup a directory or a path in iOS project?
0
0
76
Mar ’25
Questions about Deployment Targets in Xcode
The “Deployment Targets” for iOS was IOS12 or higher in Xcode15, but is now listed as IOS15 or higher in Xcode16. https://developer.apple.com/support/xcode/ How does this change affect developers and users? For example, if a developer specifies less than iOS15 in the “iOS Deployment Target” on Xcode, how will this affect them? Also, will users under iOS 15 be unable to run the apps?
0
0
99
May ’25
Xcode16.x+ios18.x simulator crashing and tests are failing
We are seeing crashes after upgrading to xcode16.x ( tested with 16.1 , 16.2 and 16.3) and ios 18.1, 18.2, 18.3.1 and 18.4 . when tests are running simulator is crashing with mulitple reasons. CoreSimulatorService[85444] <Error>: Failed to get a device identity for simulator device BFAD684E-A48A-4170-80E1-8FBC04744E79, error: Error Domain=com.apple.MobileActivation.ErrorDomain Code=-1 "Failed to create BAA info." UserInfo={NSLocalizedDescription=Failed to create BAA info., NSUnderlyingError=0x600002072a60 {Error Domain=com.apple.MobileActivation.ErrorDomain Code=-1 "Failed to query baa info." UserInfo={NSLocalizedDescription=Failed to query baa info., NSUnderlyingError=0x600002073390 {Error Domain=com.apple.MobileActivation.ErrorDomain Code=-1 "Failed to load cryptex1 manifest." UserInfo={NSLocalizedDescription=Failed to load cryptex1 manifest., NSUnderlyingError=0x600002071110 {Error Domain=com.apple.MobileActivation.ErrorDomain Code=-1 "Failed to load firmware data from /System/Volumes/iSCPreboot/F743DA4B-92E7-4E92-ACD2-40775DF4B5A2/cryptex1/current/apticket.j274ap.1A256C21D3001E.im4m." UserInfo=0x600003b47bc0 (not displayed)}}}}}} sometimes crashing with [02:47:24]: ▸ Tests_iOS-Runner encountered an error (Failed to prepare device 'Clone 2 of iPhone 16 Pro' for impending launch. (Underlying Error: Unable to boot the Simulator. launchd failed to respond. (Underlying Error: Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding))) sometimes with [18:44:47]: ▸ 2025-05-08 18:44:47.019 xcodebuild[75752:6252304] [MT] IDELaunchReport: a616bd895a3ee240:a616bd895a3eec00:Install Actions Finished with error: Unable to boot the Simulator. [18:44:47]: ▸ Domain: NSPOSIXErrorDomain [18:44:47]: ▸ Code: 60 [18:44:47]: ▸ Failure Reason: launchd failed to respond. [18:44:47]: ▸ User Info: { [18:44:47]: ▸ Session = "com.apple.CoreSimulator.SimDevice.BD4A5DAB-3317-44D1-AFD1-C6EED090BB20"; [18:44:47]: ▸ } [18:44:47]: ▸ -- [18:44:47]: ▸ Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding [18:44:47]: ▸ Domain: com.apple.SimLaunchHostService.RequestError [18:44:47]: ▸ Code: 4 [18:44:47]: ▸ -- [18:44:47]: ▸ 2025-05-08 18:44:47.019 xcodebuild[75752:6252304] [MT] IDELaunchReport: a616bd895a3ee240:a616bd895a3eec00:Install Actions com.apple.dt.IDERunOperationWorkerFinished { [18:44:47]: ▸ "operation_duration_ms" = 55114; [18:44:47]: ▸ "operation_errorCode" = 60; [18:44:47]: ▸ "operation_errorDomain" = NSPOSIXErrorDomain; [18:44:47]: ▸ "operation_name" = "_IDEInstalliPhoneSimulatorWorker"; [18:44:47]: ▸ } sometimes crashing with Run test suite Tests2 encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal term before starting test execution.))
0
2
525
May ’25
Build Libraries For Distribution flag usage
I want to build an ios .xcframework (for external delivery) and .framework(for internal debugging) in order to package some code to a customer for incorporation into their app. My framework has a dependency upon RealmSwift, which I've added using SPM. There is a warning saying Module RealmSwift was not compiled with library evolution support. And when building SwiftVerifyEmittedModuleInterface fails with an error saying "missing required modules: 'Realm.Private', 'Realm', 'Realm.Swift'" By default, Build Libraries For Distribution was set to YES, however if I turn it off then the warning and error go away and I can cleanly build the framework. I've been attempting to get a good understanding of this flag and if it should be used or not, most material says yes but doesn't go a good job of explaining why. However anyway I can't get the framework to build with RealmSwift as a dependency without turning off this flag. Therefore is that ok to proceed down that route? Does the fact the xcframework will only ever be distributed to one consumer affect decisions (i.e. binary compatibility etc.) Thanks
0
0
120
Mar ’25
FamilyControls Framework info.plist missing
We are trying to create a screentime app using the Family Controls as well as Device activity frameworks. The build succeeds but while pushing to an iphone we are getting an info.plist file for deviceactivity.framework could not be found error. For reference when using the Screentime API a physical device must be used not a simulator. When we remove the device activity framework this error also occurs for the family controls framework. We have added the Family Controls(development) Capability and applied for the distribution capability. We have redownloaded xcode multiple times on the main device, deleted derived data, and redownloaded all of the iphone SDKs and the issue still persists.
0
0
237
Mar ’25
Run on multiple simulators
I am developing a game that has 3 team members. I can manually start up 3 simulators and run the game for developing/testing but seem like there should be a simple way to click build/run and have it launch on all three automatically. Does anyone know how to do this or if its even possible without writing some scripts?
0
0
63
Mar ’25
Firebase Phone Auth OTP not working on TestFlight
Hi, I'm working in unity and I've implemented Firebase Phone Number Authentication in it. Everything works fine when I directly install build from xCode. App Attest screen shows up, user receives OTP on their phone and login works. But when I download the same build from TestFlight, it gets stuck after the user sends OTP request. I've added Push Notifications and App Attest in capabilities. I've also additionally added Remote Notifications. In device log I see an error about mobile provisioning file but I've added that to my account also. Is this expected behavior that phone number authentication does not work on TestFlight? If yes, how can I get this approved from apple since they need to test it before approving it. Thanks!
0
0
225
Feb ’25
Fetch Changes not working Xcode 16.2
I have cloned a private repo from GitHub and for the most part it seems to be working fine. e.g. commit, push and pull are working. However, Fetch Changes doesn't seem to work at all. It pops up a brief message as if it is working, but the status of my local branch under the Source Control Navigator -> Repositories does not get updated. Even after a push, the status still tells me I am ahead on the local branch. If I add a new file on the GitHub website, Fetch Changes will not see it and the repository status remains unchanged. All of these changes are immediately visible in 'Fork' (3rd party Git GUI). If I restart Xcode the status is updated correctly, but it does not keep up with further changes. Anything I can do other than avoid using Xcode for GitHub tasks? Update: This might just be a problem with the Source Control Navigator views not updating. I just found that if I change branch, the "Repositories" section will not reflect the branch change until I exit and re-enter that view. e.g. click on "Changes" and back into "Repositores" to see the update. That workaround does not impact the out of date repo status though (how many commits am I ahead or behind). Seems very buggy...
0
2
334
Jan ’25