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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Different optimization level for package dependencies
I am using DuckDB as an external dependency in my project. The package is basically a Swift wrapper around C++ code. If I run my app in Debug mode, then the performance of the library is an order of magnitude slower than when I run it in Release mode. In Release mode it is really fast, but compilation times are too slow. I am a complete beginner to Xcode's build system and was wondering if there was any way to have the best of both worlds? For example, by compiling my SwiftUI code without optimizations but having it linked to a static and optimized version of the library.
0
0
418
Nov ’24
ExternalLinkAccount API
I am having a very strange problem with await ExternalLinkAccount.canOpen On some apps using the same project and code (different targets) it reports false, but works in the simulator. Some apps work both in the simulator and a device and, but some apps only work in the simulator. They are all sharing the same code. What could be wrong? They all have SKExternalLinkAccount and the correct url in plist and they also have the com.apple.developer.storekit.external-link.account entitlement
1
0
250
Dec ’24
Configure Format to Multiple Lines?
Is there any way to modify the behaviour of this command? I really dislike that it adds a break after the opening parenthesis and would also prefer it to use the traditional multi-line style where the lines are aligned with their semicolons. Alternatively, is there a way to run the "Format File with 'swift-format'" command without implicitly triggering "Format to Multiple Lines", as it apparently does? Having to reformat my method's signatures afterwards really makes this feature unattractive to me at the moment.
0
0
128
Jan ’25
Can't connect XCode and brand new Iphone 16 pro
I have this error for 5 min : title: Waiting to reconnect to {Iphone_Name} content: Previous preparation error: The developer disk image could not be mounted on this device.. Error mounting image: 0xe800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.) after a while : title: The developer disk image could not be mounted on this device. content: Error mounting image: 0xe800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.) What has been tryed : - Xcode : clean - Xcode : close - Iphone : unpluged - Iphone : Remove trusted device - Iphone : Remove Dev mode - Iphone : Re-active dev mode (then reboot) - Iphone : Accepte dev mode - Iphone : wait 5 min - Iphone : connect to the macbook pro (M1) - Iphone : accepte first form - XCode : start it - Iphone : accepte second form - XCode : select my project THEN BUG SAME PLAIN OLD APPLE BUG (again and again) (I have try it like 20 times, i'm fed up now) I have paid for a pro (100euros) account to be able to push to my brand new iphone. I have tried everything, like : remove xcode, re-install it. No Update for the iphone. sudo installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target / What I can do : - Buy a subscription to store my iphone on icloud (cause basic option is already full) - Ask a refound for the iphone (obviously not working) and my apple subscription developers. And fix my old iphone. No point to buy brand new device that is not working. Also, same error with my brand new ipad pro 16 pouce. I can't push to the store, cause you ask screen shot. But I can't start the apps, so i can't have screen shot. So i have to change my plans in terms of project. Please help, before I switch to a full web stack based on rust
1
0
716
Nov ’24
Error: Info.plist/Multiple commands produce
Background and Issue Details Currently, I am working on an Xcode project, and even after correctly setting up the Info.plist file, I am encountering build errors. Despite verifying all configurations related to Info.plist, the following errors persist during the build process: Error Messages 1、Multiple commands produce '/path/to/DerivedData/Info.plist' ・The error suggests that there might be a conflict or duplication of Info.plist in the Copy Bundle Resources phase, but only one Info.plist exists in the project. 2、duplicate output file ・A warning indicating that there is a conflict with the output file path for the Info.plist file during the build process. Steps Taken to Resolve the Issue 1、Verified Info.plist Files in the Project ・Checked the project directory for any duplicate Info.plist files using the following command: find . -name "*.plist" Only one Info.plist file exists in the project. ・Used the grep command to inspect the project.pbxproj file for INFOPLIST_FILE references: grep -r "INFOPLIST_FILE" ./MyProject.xcodeproj/project.pbxproj The INFOPLIST_FILE settings point to the correct Info.plist file. 2、Checked Copy Bundle Resources ・Verified the Copy Bundle Resources build phase and ensured that only one Info.plist file is listed. Deleting it results in the Target Membership checkbox being unchecked, and the error persists. 3、Cleared Cache ・Deleted DerivedData and Xcode cache directories to ensure no stale data is causing the issue: rm -rf ~/Library/Developer/Xcode/DerivedData rm -rf ~/Library/Caches/com.apple.dt.Xcode 4、Created a New Project ・Created a new project and set up a fresh Info.plist file with minimal content, but the same error occurred. Current Project Settings ・The contents of the Info.plist file are as follows: 5、Xcode Version ・The version of Xcode I'm using is 15.2 ・OS is Ventua13.7.1 Questions ・What could cause the Multiple commands produce and duplicate output file errors in this scenario? ・Are there any other settings or configurations I should investigate beyond the Info.plist file and build phases? ・Have there been similar cases reported by other developers, and what were the solutions? ・Could you provide a step-by-step guide to test the functionality of Info.plist in a minimal project while avoiding duplication errors? ・Is there an official or alternative workflow to create a project where Info.plist duplication errors are preemptively avoided? ・Additionally, what are the best practices for linking Info.plist in Build Settings and avoiding conflicts during the build process? Thank you.
2
0
608
Dec ’24
Run identical UI/Unit tests on different build targets
I have different versions of my iOS App (written in SwiftUI). The app on the store, the App Clip, and one or two next version apps not yet released (e.g. A/B comparison). All good. But now I've started creating UI and Unit tests and I'm confused about how to get this working. Each build target has its own scheme. And in that scheme I have a Test plan for that target. E.g. The App Clip scheme has an App Clip test plan. Since all the app variants are very similar, I only have one set of unit tests and one set of UI tests so each test plan includes the same unit test target and the UI test target. Problem: When I selected a scheme (e.g. for the App Clip) and ran the tests, it turned out that all the tests ran for another build target, not the target of the scheme. I think this might be because within the definition of the test target there's a field specifying the host application. I.e. the build target. Question: How can I set up my project so that the test plan uses the relevant target build? Or do I have to duplicate all the test targets (one for each target)? Or do I have to manually change each test target before running it for a particular build target?
1
0
587
Nov ’24
"No such module" error when trying to create module
Am running Xcode 16.1 on Sequoia and am getting "No such module" error. Here are my steps: Create workspace in Xcode and name it AccessControl2 Create Project named OrangeInc and add it to AccessControl2 group. Create blank playground named AccessControl and add it to AccessControl2 group Error message in playground after I add "import OrangeInc" reads "No such module" Have tried repeating this several times; get same error message.
0
0
283
Dec ’24
Launchd won't run a daemon that calls setuid in Sonoma, but it will allow it in Sequoia and Monterey
We have a daemon (/Library/LaunchDaemons) that has been calling setuid (usr/include/unistd.h) for some time. Launchd allowed that until we started compiling using Xcode 16 (maybe even Xcode 15). But now we have to remove that call for launchd to allow the daemon to run. That's not really an issue to remove that call but it is very mysterious that it only fails in Sonoma. Works in Sequoia and Monterey. Why is that? We found this after adding some logging to our daemon plist: The application with bundle ID <redacted> is running setugid(), which is not allowed. Exiting. We're actually calling setuid.
0
0
193
Nov ’24
Vision Framework Causes EXC_BREAKPOINT Error in Xcode App Playground (.swiftpm) File
I’m trying to use the Vision framework in a Swift Playground to perform face detection on an image. The following code works perfectly when I run it in a regular Xcode project, but in an App Playground, I get the error: Thread 12: EXC_BREAKPOINT (code=1, subcode=0x10321c2a8) Here's the code: import SwiftUI import Vision struct ContentView: View { var body: some View { VStack { Text("Face Detection") .font(.largeTitle) .padding() Image("me") .resizable() .aspectRatio(contentMode: .fit) .onAppear { detectFace() } } } func detectFace() { guard let cgImage = UIImage(named: "me")?.cgImage else { return } let request = VNDetectFaceRectanglesRequest { request, error in if let results = request.results as? [VNFaceObservation] { print("Detected \(results.count) face(s).") for face in results { print("Bounding Box: \(face.boundingBox)") } } else { print("No faces detected.") } } let handler = VNImageRequestHandler(cgImage: cgImage, options: [:]) do { try handler.perform([request]) // This line causes the error. } catch { print("Failed to perform Vision request: \(error)") } } } The error occurs on this line: try handler.perform([request]) Details: This code runs fine in a normal Xcode project (.xcodeproj). I'm using an App Playground instead (.swiftpm). The image is being included in the .xcassets folder. Is there any way I can mitigate this issue? Please do not recommend switching to .xcodeproj, as I am making a submission for Apple's Swift Student Challenge, and they require that I use .swiftpm.
1
0
434
Dec ’24
Assistance Required for Accessing Non-Secure HTTP API in Ionic Build App
Dear Team, I was previously able to access a non-secure HTTP API in my Ionic-built app. However, I am now encountering an error where the API requests are being rejected. Interestingly, this API works perfectly on Android and web platforms without any issues. As part of my troubleshooting, I have already added the following lines to my Info.plist file: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> Could you kindly suggest any alternative solutions or additional settings required to access this HTTP API? Your help would be greatly appreciated. Thank you, Mozib
0
0
154
Jan ’25
Xcode version 14.2 crashes as soon as opened in mac os 15.0.1
I have downloaded xcode version 14.2 from apple official archive. I ran xcode using these steps: Right click -> Show Package content Go to folder Contents -> Macos -> Xcode Run the xcode terminal app After this as soon as I try to open a project, xcode crashes. How do i run xcode of lower version as that specific version is required, I don't want to downgrade my macos as it will result in clearing my data or I have to transfer data. Please help me with this issue.
1
0
329
Dec ’24
watchOS 4 in Xcode 16
I saw in the Xcode 16 release notes that on-device debugging is no longer available on watchOS prior to version 7.0, but I can't even get a signed, compiled app to run on an older watch. The current version I have live in the App Store works just fine on 4.3.2. I have changed no code, I just started building the app with Xcode 16, and now it won't launch on older watches. Is it no longer possible to update an app for older watches?
2
0
560
Dec ’24
Per-project ProjectName-Swift.h, rather than per-target
Dear Experts, I have an Xcode project that generates two iOS app targets. Most of the code is shared between the two targets. Let's call them "Project", "App1" and "App2". I have some Swift code that is called from objC++. To make this work, in the objC++ files currently I #include "App1-Swift.h". Clearly this only works when building App1. What's the right way to set this up to work for both targets? Looking at the build settings, currently the "Generated Header Name" is set to "$(SWIFT_MODULE_NAME)-Swift.h". Presumably, SWIFT_MODULE_NAME expands to the target name. There are various possible ways to fix this, but which one is "right"? I bet that if I fix it in the wrong way, something else will go wrong later. I could: Change the objC++ to #include different headers depending on the target being built. Change the build setting to use the project name (from a variable?) instead of the SWIFT_MODULE_NAME. Somehow cause SWIFT_MODULE_NAME to equal the project name, rather than the target name. Any advice? Thanks.
0
0
347
Nov ’24