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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Can someone help me fix my xcode.
This is for a profile page for the app I am building. let updatedUser = User( coder: <#NSCoder#>, id: userId, name: name, email: email, phoneNumber: phoneNumber, profilePictureURL: nil, bio: bio ) Error code by line 1: Extra arguments at positions #2, #3, #4, #5, #6, #7 in call Error code by profile picture: 'nil' requires a contextual type This error at the bottom of the code: Expected '}' in struct Can someone please help me?
6
0
147
1w
Unable to build complex Mac app project with 8 targets since upgrading to Mac OS Sequoia
I have a complex project that used to compile without any problems that i could not solve before I bought a new iMac (the latest, M4), which came with macOS Sequoia. I've ben able to compile the whole project since 1998, which has evolved into an AppKit Mac app written almost completely in Swift. I am also able to compile this project on Xcode 16.1 on MacOS Sonoma. However, since I upgraded to MacOS Sequoia, I am stumped with lots of errors that I don't know how to fix. Many of them are related to new build system, which works fine in smaller projects I have written, but it completely breaks when I use this more complex project. I've been unable to create a focused project so I can file a DTS incident, because when I try to recreate it in a new, more focused project, the problem goes away. I tried to transfer the code to a freshly created project, and I was able to make it build again without errors, but then this new project just creates empty bundles without any resources and executables in them. In almost 25 years of experience in coding, I've never encountered such huge problems with just a MacOS upgrade. I would like to have some guidance on how to proceed. Here is an example of the errors I'm getting: error: unable to write file '/SchIS64.build/Objects-normal/arm64/SchIS64.LinkFileList': fopen(/SchIS64.build/Objects-normal/arm64/SchIS64.LinkFileList, wb): No such file or directory (2) (in target 'SchIS64' from project 'Scheduler (Cocoa)') WriteAuxiliaryFile /SchIS64.build/unextended-module.modulemap (in target 'SchIS64' from project 'Scheduler (Cocoa)') cd /Users/admin/Documents/Development/Scheduler/Scheduler write-file /SchIS64.build/unextended-module.modulemap WriteAuxiliaryFile /SchIS64.build/unextended-module-overlay.yaml (in target 'SchIS64' from project 'Scheduler (Cocoa)') cd /Users/admin/Documents/Development/Scheduler/Scheduler write-file /SchIS64.build/unextended-module-overlay.yaml WriteAuxiliaryFile /SchIS64.build/SchIS64.hmap (in target 'SchIS64' from project 'Scheduler (Cocoa)') cd /Users/admin/Documents/Development/Scheduler/Scheduler write-file /SchIS64.build/SchIS64.hmap
3
0
150
1w
Download & replace app container
I used to download and replace the app container when I was testing, essentially downloading the container from the live app, and restoring it into the test app in order to not affect the live app, but to test major changes on "live" data. it seems the option for downloading and replacing in Xcode no longer works, I will sometimes get a container downloaded, other times it only part downloads. I can never seem to get it to replace. No errors, but it doesn't work on the new device. It used to be that devices & simulators showed when it was downloading and replacing but it no longer does that. Is there another way of doing this? Currently I'm having to take a backup of the live phone, restore on the test device, then delete all the unneeded apps, otherwise the restore takes ages, then backup the test device and restore every time I need to restart.
0
1
96
1w
Xcode simulator & preview not loading
Hello, I recently decided to start learning how to code for iOS. I don't have much coding experience but I still wanted to explore it for fun at least. I downloaded Xcode on my Macbook, and opened a new iOS file after downloading iOS 18.1 so I could run the simulator/get a preview of my code. Even though I only had the basic "Hello World!" that is auto-generated in my code, the preview would never show and sat at a loading screen for multiple hours, saying "Preparing (Automatic) iPhone Simulator" at the top. There is probably a simple solution that I'm missing. I would appreciate any tips! Thanks.
1
0
133
1w
Additional assets/icons won't be included in the build in versions above 15
Hello! Recently, I noticed that my build isn’t including additional assets (icons). I tried using two different versions of Xcode (16.1 and 15.4) on separate Macs, but I’m getting the same result. Not all icons are being included in the build. However, I found that if I set my minimum deployment version to 14, all of the icons appear as expected. Starting from target version 15 in Xcode, no additional icons are included. Is there any way to resolve this?
0
0
61
1w
App Not Launching on Device After Xcode 16.1 Update
Hi everyone, Since updating to Xcode 16.1 on macOS Sequoia 15.0.1, I’m having issues with my app not launching on my iOS device. The app finishes compiling in Xcode without any errors, but it never appears to launch on the device—it either gets stuck indefinitely or doesn’t show any progress on the device screen. Details of the Issue: Xcode shows that the app is launching, but there’s no progress on the device. Tried on multiple devices with the same result. Troubleshooting Steps I’ve Tried: Cleaned the build folder and deleted derived data. Verified the deployment target matches the device’s iOS version. Checked provisioning profiles and code signing settings. Restarted both Xcode and my device. Tried connecting over both USB and Wi-Fi. Workaround Found: Unpairing the device from Xcode, pairing it again, then turning off Wi-Fi on the device before building allows the app to launch successfully. Has anyone else experienced this with Xcode 16.1? Any tips on a more permanent solution or other troubleshooting steps would be greatly appreciated. Thank you!
0
1
87
1w
Inquiry about Open Source Release of Xcode 15's ld Source Code
Inquiry about Open Source Release of Xcode 15's ld Source Code Dear Apple Developer Support Team, I hope this email finds you well. I am a developer with a keen interest in Apple's development toolchain. I noticed that Xcode 15 uses a new version of the linker (ld), and I'm particularly interested in its source code. I would like to inquire about: When will the source code for the ld linker used in Xcode 15 be made available as open source? Your response would be greatly appreciated. Thank you for your time and attention to this matter. Best regards, Panghu
1
0
49
1w
Xcode 16 project build malfunction
I have one project, it has one Swift (AppKit) App and one C++ dylib project, I don't have problem in build the dylib, but when build the UI App, there will be an error: "ld: multiple errors: file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o' clang++: error: linker command failed with exit code 1 (use -v to see invocation)" Clean project folder and rebuild - it won't fix I tried remove the two Swift files and added it again- it won't fix Delete DerivedData folder - it won't fix I upgraded to Xcode 16.1 - also tried above, it won't fix BUT: the project doesn't have any problem when build with Xcode 15
2
0
162
1w
Another Xcode doc. error: Non-existent 'App Icons & Launch Images' menu item
In "Create asset catalogs and sets" - https://help.apple.com/xcode/mac/current/#/dev10510b1f7 - I read this: " Create an iOS or tvOS launch screen image set: Choose App Icons & Launch Images > New [OS] Launch Image from the Add button (+) or from the Editor > Add Assets menu. For an iOS app, you can also change the default launch screen source to an image set. " But neither the Editor -> Add New Asset menu nor the Add button (+) menu contains an "App Icons & Launch Images" item. I can add that I use Xcode 16.1. So again, the Xcode documentation is quite misleading and confusing! My (real) question is if it is possible to give Xcode ONE launch image from which Xcode creates all necessary image sizes automatically? Or do we still need the apps and services that creates a bunch of launch images from ONE image?
1
0
90
2w
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
87
2w
iOS Build Availability in Xcode
When attempting to fix an issue that is only happening on a specific iOS build I noticed that I am not able to install that specific build on my simulator. Is there any way to get specific iOS builds that are not available through Xcode? Example: The bug I am trying to fix is only happening on 17.6.1 and 17.7.1. These specific builds are not available through Xcode. Attempted Resolution: I found a iPhone14,5_17.6.1_21G101_Restore.ipsw file but was not able to import it into Xcode for use nor was I able to use it on a physical device.
0
0
98
2w
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
126
2w
Problem with in-app payment on iphone simulator in Xcode
Hi, I am testing payment on simulator. It worked previously but stopped. I am getting an error: <SKPaymentQueue: 0x600000031200>: Payment completed with error: Error Domain=ASDErrorDomain Code=530 "(null)" UserInfo={client-environment-type=Sandbox, storefront-country-code=USA, NSUnderlyingError=0x600000c61fe0 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed The authentication failed." UserInfo={NSMultipleUnderlyingErrorsKey=( "Error Domain=AMSErrorDomain Code=2 "Password reuse not available for account The account state does not support password reuse." UserInfo={NSDebugDescription=Password reuse not available for account The account state does not support password reuse., AMSDescription=Password reuse not available for account, AMSFailureReason=The account state does not support password reuse.}", "Error Domain=AMSErrorDomain Code=0 "Authentication Failed Encountered an unrecognized authentication failure." UserInfo={NSDebugDescription=Authentication Failed Encountered an unrecognized authentication failure., AMSDescription=Authentication Failed, AMSFailureReason=Encountered an unrecognized authentication failure.}" ), AMSDescription=Authentication Failed, NSDebugDescription=Authentication Failed The authentication failed., AMSFailureReason=The authentication failed.}}}
1
0
140
2w
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
100
2w
My App crashes run-time occasionally when I use AVFoundation and related code
I am developing an app for Vehicle owners with a built-in map navigation feature with voice navigation support. The app works fine without voice navigation but when I use voice navigation it occasionally crashes and it crashes while voice navigation is not in progress. What makes it impossible to diagnose is that even though it crashed 10 times on the flight, I don't see any crash reports in 'Apple Connect'. I tried running it in a simulator and it didn't crash there! but on a real device, when I drive with the app navigating me I crashes abruptly after a few minutes and it's not while the voice navigation is speaking! I also ran the app without AVFoundation and it did not crash then. So I am 100% sure it is something with this AVFoundation framework. If anyone can help find the problem in my following code it would be really helpful. import SwiftUI import AVFoundation struct DirectionHeaderView: View { @Environment(\.colorScheme) var bgMode: ColorScheme var directionSign: String? var nextStepDistance: String var instruction: String @Binding var showDirectionsList: Bool @Binding var height: CGFloat @StateObject var locationDataManager: LocationDataManager @State private var synthesizer = AVSpeechSynthesizer() @State private var audioSession = AVAudioSession.sharedInstance() @State private var lastInstruction: String = "" @State private var utteranceDistance: String = "" @State private var isStepExited = false @State private var range = 20.0 var body: some View { VStack { HStack { VStack { if let directionSign = directionSign { Image(systemName: directionSign) } if !instruction.contains("Re-calculating the route...") { Text("\(nextStepDistance)") .onChange(of: nextStepDistance) { let distance = getDistanceInNumber(distance: nextStepDistance) if distance <= range && !isStepExited { startVoiceNavigation(with: instruction) isStepExited = true } } } } Spacer() Text(instruction) .onAppear { isStepExited = false utteranceDistance = nextStepDistance range = nextStepRange(distance: utteranceDistance) startVoiceNavigation(with: "In \(utteranceDistance), \(instruction)") } .onChange(of: instruction) { isStepExited = false utteranceDistance = nextStepDistance range = nextStepRange(distance: utteranceDistance) startVoiceNavigation(with: "In \(utteranceDistance), \(instruction)") } .padding(10) Spacer() } } .padding(.horizontal,10) .background(bgMode == .dark ? Color.black.gradient : Color.white.gradient) } func startVoiceNavigation(with utterance: String) { if instruction.isEmpty || utterance.isEmpty { return } if instruction.contains("Re-calculating the route...") { synthesizer.stopSpeaking(at: AVSpeechBoundary.immediate) return } let thisUttarance = AVSpeechUtterance(string: utterance) lastInstruction = instruction if audioSession.category == .playback && audioSession.categoryOptions == .mixWithOthers { DispatchQueue.main.async { synthesizer.speak(thisUttarance) } } else { setupAudioSession() DispatchQueue.main.async { synthesizer.speak(thisUttarance) } } } func setupAudioSession() { do { try audioSession.setCategory(AVAudioSession.Category.playback, options: AVAudioSession.CategoryOptions.mixWithOthers) try audioSession.setActive(true) } catch { print("error:\(error.localizedDescription)") } } func nextStepRange(distance: String) -> Double { var thisStepDistance = getDistanceInNumber(distance: distance) if thisStepDistance != 0 { switch thisStepDistance { case 0...200: if locationDataManager.speed >= 90 { return thisStepDistance/1.5 } else { return thisStepDistance/2 } case 201...300: if locationDataManager.speed >= 90 { return 120 } else { return 100 } case 301...500: if locationDataManager.speed >= 90 { return 150 } else { return 125 } case 501...1000: if locationDataManager.speed >= 90 { return 250 } else { return 200 } case 1001...10000: if locationDataManager.speed >= 90 { return 250 } else { return 200 } default: if locationDataManager.speed >= 90 { return 250 } else { return 200 } } } return 200 } func getDistanceInNumber(distance: String) -> Double { var thisStepDistance = 0.0 if distance.contains("km") { let stepDistanceSplits = distance.split(separator: " ") let stepDistanceText = String(stepDistanceSplits[0]) if let dist = Double(stepDistanceText) { thisStepDistance = dist * 1000 } } else { var stepDistanceSplits = distance.split(separator: " ") var stepDistanceText = String(stepDistanceSplits[0]) if let dist = Double(stepDistanceText) { thisStepDistance = dist } } return thisStepDistance } } #Preview { DirectionHeaderView(directionSign: "", nextStepDistance: "", instruction: "", showDirectionsList: .constant(false), height: .constant(0), locationDataManager: LocationDataManager()) }
2
0
175
2w
Xcode 16 missing the DeviceSupport for iOS17 and above
i am unable to deploy the iOS app with automation using below command: ios-deploy --bundle /Users/XXXX/Library/Developer/Xcode/DerivedData/iOSClient2-XXXXXXX/Build/Products/Debug-iphoneos/iOSClient2.app/ --id 00008020-XXXXXXXXX --justlaunch --verbose with the error: ------ Debug phase ------ Starting debug of 00008120-000C713236E0A01E (D38AP, D38AP, uknownos, unkarch, 18.1, 22B83) a.k.a. 'Svt’s iPhone' connected through USB... Device Class: iPhone build: 22B83 version: 18.1 Found Xcode developer dir /Applications/Xcode.app/Contents/Developer version: 18.0 version: 18 2024-11-08 15:26:09.531 ios-deploy[33496:644410] [ !! ] Unable to locate DeviceSupport directory with suffix 'DeveloperDiskImage.dmg'. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown! Observation: Xcode 16 missing the DeviceSupport for iOS17 and above. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/.... Xcode: Version 16.1 (16B40 iOS: iOS17 and above
0
0
110
2w
Xcode 16 destroys Objective-C Developer Documentation
In Xcode 16, even if Objective-C is selected, the Navigator in the documentation viewer displays Swift information. I don't know when this bug was introduced, but it's there in the last Xcode 16 betas at least. I hope as many developers as possible submit this bug to Apple to get their attention. P.S. Yes, I know there's Dash. For many years, Dash was a much better option than Xcode's built-in viewer. However, in version 5, the Dash developer introduced some unfortunate UI changes that made Xcode a better option to view the documentation in certain cases. Unfortunately, the Dash developer doesn't seem to be interested in user feedback anymore. He's been ignoring suggestions and user requests for years by now.
4
0
170
2w
Xcode doc. error: There is no 'asset catalog' in Project Navigator
In several places on https://developer.apple.com/documentation/xcode/configuring-your-app-icon I read: "In the Project navigator, select an asset catalog." But my Project Navigator does NOT contain any "asset catalog". So it's impossible to follow the instructions of the documentation, and thus specify a new app icon (set). I can add that I use Xcode 16.1 on MacOS 15.0.1 Sequoia. I have added a screen shot to document what I am saying. I have also reported this error in https://feedbackassistant.apple.com/feedback/15738182
2
0
131
2w