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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

ccache in xcode 16
I have a xcode project generated by unity 6 my mac: my x-code: It's a simple project but the building time lasted over 10 minutes and I found a page https://discussions.unity.com/t/optimizing-ios-and-macos-build-times-using-ccache/809570 I tried to run ccache in my mac and hope to accelerate the building. I installed ccache in my MAC by brew I made two script with +x mode I created a testc folder to verify the script and it did work. Then I opened the xcode and added CC and CXX to the “Build Settings” I triggered the building But it didn’t work, the building used the default compiler. I had repeated to ask AI about it and cleaned building cache many times, but the problem still exists. Even without any probing executing of the ccache-clang script ( I configured the log file position, so if it has been executed once, there will be some logs) Could someone help me check if there’s something wrong?
1
0
381
Mar ’25
XCode 16.2 is randomly removing my account
I am signed into Xcode for automatic signing. Which works for a random amount of builds and then the Account/AppleID dissappears from Xcode. This is a vital part of our CI/CD processes and disrupts the workflow alot. MacOS version: Apple M2 15.3 (24D60) Sequoia related: https://developer.apple.com/forums/thread/724434 https://stackoverflow.com/questions/50252887/account-automatically-removed-from-xcode
1
2
502
Mar ’25
Change app language on Apple Watch simulator
I feel a bit dumb now. I once succeeded to change the language of an app on Watch simulator. So it is possible. And I'm not able to repeat (fool of me I did not took note of how I did it). I just remember it was simply through some language settings selection, may be rebooting the Mac, but not by changing anything in code. Does someone know how to do ?
3
0
515
Mar ’25
Gaps in Xcode build timeline
Reposting (after a while) from the Swift forums - the build timeline for our project has a lot of weird gaps in the beginning - almost 15 seconds in total, which is quite a big chunk of the total build time. Is there any way to determine why they exist or how I could fix them? I hope it's just something hidden and not the build system literally doing nothing... This is on Xcode 15.4.
1
0
462
Mar ’25
Xcode 16 Crash While Validating (com.apple.root.default-qos)
Hello, We're attempting to validate our application archive through Xcode but the application is crashing during the validate step and we're not sure why. Platform: macOS 15.1 Arch: arm64 We've confirmed that our developer agreements are up to date (a suggestion made by other posts on these forums). Other suggestions have been to downgrade Xcode but we're hoping there's another explanation. The application is quite complex - many libraries and framework - but executes as expected during development and testing. Crash Report Any insight into this error would be appreciated. We're sure it's something wrong with our plist or archive structure but the crash is limiting our ability to debug.
5
0
561
Mar ’25
How to identify apps in FamilyActivitySelection?
Questions I am developing a social screen time application that enables users to create “sprints” and set sprint goals—essentially time limits on usage for selected applications. For this functionality, users select the apps they wish to manage using the FamilyActivitySelection interface (from the FamilyControls framework). However, our backend needs to distinguish each application uniquely (for example, via the app’s bundle identifier) in order to correctly map and enforce user-defined sprint goals. Unfortunately, we are encountering an issue where retrieving the bundle identifier directly from the FamilyActivitySelection is returning nil. As a result, we are unable to globally identify the selected apps. Could you please advise if there is an alternative method or property available in the FamilyControls API that would allow us to uniquely identify the apps? Alternatively, is there another approach recommended by Apple for obtaining a global identifier for applications selected via FamilyActivitySelection? Thank you for your time and assistance. I look forward to your guidance on how to resolve this issue. Code The following is the print statement I used to check if bundleIdentifier is nil after I stored user's selections to the variable selection using familyActivityPicker: for app in selection!.applications { let bundleId = app.bundleIdentifier ?? "Unknown Bundle ID" let token = app.token let localizedDisplayName = app.localizedDisplayName ?? "Unknown Localized Display Name" print("Selected app bundle identifier: \(bundleId)") print("localizedDisplayName: \(localizedDisplayName)") } Console log result I received from the print statement above: Selected app bundle identifier: Unknown Bundle ID localizedDisplayName: Unknown Localized Display Name
4
0
444
Mar ’25
XCFrameworks deploying .a / include to output target directory
Hello Friends, We have a strange bug that Xcode is deploying static binaries from within .XCFramework into the CONFIGURATION_BUILD_DIR An example of our xcframeworks structure is: <?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>AvailableLibraries</key> <array> <dict> <key>BinaryPath</key> <string>libglfw3.a</string> <key>HeadersPath</key> <string>Headers</string> <key>LibraryIdentifier</key> <string>macos-arm64_x86_64</string> <key>LibraryPath</key> <string>libglfw3.a</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>macos</string> </dict> </array> <key>CFBundlePackageType</key> <string>XFWK</string> <key>XCFrameworkFormatVersion</key> <string>1.0</string> </dict> </plist> for open source creative coding toolkit https://github.com/openframeworks/openFrameworks Can you see any issues in the above. Some ideas for me is to generate xcarchive instead of deploying the .a in the xcframeworks, however that does not explain the include being packaged there, so I think this might be a Xcode issue
0
0
175
Mar ’25
Xcode 16 is running on an iPhone 7 with iOS 12.1.3. The application fails to open normally and crashes immediately upon startup.
I am currently using Xcode 16 (16A242d) and testing on an iPhone 7 running iOS 12.1.3. However, when I try to launch the app on the device, it crashes immediately. Below are the crash logs from the iPhone 7: 错误 11:54:55.731858+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches/ATXCacheFile-_ATXAppPredictor-TotalScore 错误 11:54:55.731897+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches 错误 11:54:55.754498+0800 kernel Sandbox: duetexpertd(132) deny(1) mach-lookup com.apple.proactive.ActionPrediction.predictions 错误 11:54:55.756102+0800 duetexpertd Unable to remove recent engagement cache file. Error: Error Domain=NSCocoaErrorDomain Code=4 UserInfo={NSFilePath=, NSUserStringVariant=, NSUnderlyingError=0x100db60a0 {Error Domain=NSPOSIXErrorDomain Code=2}} 错误 11:54:56.571640+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 696; SBApplicationStateRunningReasonsKey = ( { SBApplicationStateRunningReasonAssertionIdentifierKey = UIApplicationLaunch; SBApplicationStateRunningReasonAssertionReasonKey = 10000; } ); SBMostElevatedStateForProcessID = 8; } 错误 11:54:56.829372+0800 assertiond [IGCProject:696] SyscallError: setpriority(PRIO_DARWIN_ROLE, 696, 3): No such process 错误 11:54:56.944833+0800 dasd Activity not tracked as being started, ignoring it 错误 11:55:06.153790+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 697; SBMostElevatedStateForProcessID = 8; } 错误 11:55:06.430433+0800 assertiond [IGCProject:697] SyscallError: setpriority(PRIO_DARWIN_ROLE, 697, 3): No such process 错误 11:55:13.158889+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 699; SBMostElevatedStateForProcessID = 8; } 错误 11:55:13.416290+0800 assertiond [IGCProject:699] SyscallError: setpriority(PRIO_DARWIN_ROLE, 699, 3): No such process I am trying to understand what is causing this issue. Even after archiving and installing the app, it still crashes. According to the official documentation, Xcode 16 is supposed to support iOS 12, but this issue persists. I would like to know the possible reasons for this behavior.
0
0
399
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
69
Mar ’25
Build input file cannot be found
Hi! When I run my project on a real device (iPhone 15 Pro), I encounter the following error: Build input file cannot be found: '/Users/Interexy/Library/Developer/Xcode/DerivedData/SinglePhotoBook-geecnphrjebsisdmhcyzlsefvphm/Build/Products/Debug-iphoneos/SinglePhotoBook.app/SinglePhotoBook'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? How can I solve this? I've already reinstalled Pods and cleaned DerivedData a million times, but the issue persists. Xcode: Version 15.4
0
0
294
Mar ’25
How to Mark Unused Code (Methods, Properties, Classes) in Xcode for Deletion
Is there a way to mark unused parts of the code? I am developing an app using Objective-C, and I want to delete methods, properties, and classes that are not used in the code. In IDEA, this feature works well, with unused methods grayed out. However, Xcode doesn't have this functionality, making it inconvenient for me to remove unused code.
1
0
319
Mar ’25
Adding custom document icon for document based Mac OS 16 App
Starting with Mac OS 16, Document Icons can be generated by defining a background and a Foreground element (see Apple Documentation). I've defined the mentioned elements in my Assets and in the info.plist. Unfortunately I still can't see my custom icons. Neither on existing files, nor on newly saved files. I even added a Legacy Icon - which is also not shown in Mac OS. The full source code of the app is over at gitHub . Would be great if someone could point out what I'm not seeing here. Thanks a lot, Holger Here the relevant part of the info.plist <array> <dict> <key>CFBundleTypeIconFile</key> <string>Legacy</string> <key>CFBundleTypeIconSystemGenerated</key> <integer>1</integer> <key>CFBundleTypeName</key> <string>StateTransfer Request</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>de.holgerkrupp.statetransfer.request</string> </array> <key>NSDocumentClass</key> <string>NSDocument</string> </dict> </array> <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array/> <key>UTTypeDescription</key> <string>StateTransfer Request</string> <key>UTTypeIconFile</key> <string>Legacy</string> <key>UTTypeIcons</key> <dict> <key>UTTypeIconBackgroundName</key> <string>IconBackground</string> <key>UTTypeIconBadgeName</key> <string>IconForeground</string> <key>UTTypeIconText</key> <string>REST</string> </dict> <key>UTTypeIdentifier</key> <string>de.holgerkrupp.statetransfer.request</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>httprequest</string> </array> <key>public.mime-type</key> <array> <string>application/json</string> </array> </dict> </dict> </array> <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array/> <key>UTTypeDescription</key> <string>StateTransfer Request</string> <key>UTTypeIconFile</key> <string>Legacy</string> <key>UTTypeIcons</key> <dict> <key>UTTypeIconBackgroundName</key> <string>IconBackground</string> <key>UTTypeIconBadgeName</key> <string>IconForeground</string> <key>UTTypeIconText</key> <string>REST</string> </dict> <key>UTTypeIdentifier</key> <string>de.holgerkrupp.statetransfer.request</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>httprequest</string> </array> <key>public.mime-type</key> <array> <string>application/json</string> </array> </dict> </dict> </array>
2
0
543
Mar ’25
Unit tests fails to run on Xcode 16, but works fine on Xcode 15.4 and older Xcodes
Dear Apple & Community, I am encountering an issue while running my Unit tests on Xcode 16. I'm receiving the following error in the debugger area. Error loading /var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests (133): dlopen(/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests, 0x0109): Symbol not found: _$s5Model11AccountDataV7TestingE4mockACvau Referenced from: <4027FFAF-5C6C-3F8A-9862-648D3D4A1257> /private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/<Project_name>Tests Expected in: <406DF294-634D-3D8A-8E59-BEE455BA96AF> /System/Developer/Library/Frameworks/Testing.framework/Testing Failed to load test bundle from file:///private/var/containers/Bundle/Application/FF057050-1BCC-49D8-9D3F-A3731E30F354/<Project_name>.app/PlugIns/<Project_name>.xctest/: Error Domain=NSCocoaErrorDomain Code=3588 .....
2
0
400
Mar ’25
Non-deterministic xctestplan files
Working with .xctestplan files reminds me very much of working with project files and nibs and storyboards back in the day 😅 It seems that they are non-deterministic. This means that every time we add a new test module or edit the inclusion rules at all the whole file is recomputed. But it doesn't have a fixed order so everything in the file changes. It makes it very difficult to see what has happened in PR reviews and causes conflicts any time anything is changed. TBH... because it isn't alphabetical, even just finding a particular test suite is difficult without changes. Are there any plans to bring this file format up to date with the likes of xcodeproj and xib files? It would help massively while working with source control in a larger team. Thanks
0
0
297
Mar ’25
Deep link to a file in Xcode
Hi, is there documentation on how to write a deep link that will open Xcode on a given file, and optionally a line number? I know about xed, and I would like exactly that functionality, but in link form, so that I can link to a certain file from an app such as Obsidian or from a README.md file. I checked Xcode's Info.plist and it understands several URL schemes, the most promising of which is xcode://, which successfully launches the app, but no matter what I tried, I get an error dialog telling me that Xcode did not understand the URL. Any help on this topic would be greatly appreciated. Victor
0
0
301
Mar ’25
Xcode crashes when "Build Phases" -> "Copy Files" -> "Copy only when installing" checkbox gets clicked
I've got a very simple command-line Swift project that contains a couple of OpenGL shader source files. They need to be accessed at run-time in order to be compiled and linked. For initial debugging, I hard-coded the absolute path to their location in the Xcode project directory, but I switch back and forth between two machines (MacBook Pro and Mac Studio) for which the project paths are different, so this doesn't work well. To solve this, I thought I could get Xcode to copy the shader sources over with the executable file at build time. I'm aware that technically, command-line apps have no resource bundle, but the "Build Phases" -> "Copy Files" section of the project configuration isn't disabled for my project, so I assumed that it could handle this. I added the two shader source files to the set of files to copy, via the "+" button, and set the Destination to "Products Directory". I left the "Subpath" field blank. AFAICT, nothing happens: the "Products/Debug" sub-directory of "~/Library/Developer/Xcode/DerivedData/..." has the executable, but neither of the shader sources. In fact, they don't appear anywhere inside ~/Library/Developer/Xcode. Okay, perhaps I need to uncheck "Copy only when installing" in the project config? Sadly, as soon as I click to uncheck it, Xcode crashes, even if that's the very first thing I do immediately after Xcode restarts. FWIW, I'm running Xcode 16.2 on a late 2019 MacBook Pro running Sonoma 14.6.1, but I'm pretty sure I've experienced the problem on my 2024 Mac Studio as well.
2
0
386
Mar ’25
Provisioning issues loading test app to iPhone
I get the following status fail when trying to upload a test app to my iPhone. (see attached). I have assigned it to a team, and checked automatic signing. Yet the app fails to load with the error in the image attached. First time getting an app to work properly in Xcode (yay!), and first time trying n failing to deploy it to my iPhone X (iOS 16). The phone is connected and viewable to image capture on my Mac, so I don't think the connection itself is the issue. I am using com.example.myName.appName as the bundle identifier, and since this is not a real domain, I am wondering if that is it. Could use some guidance here... ADVthanksANCE!!
4
0
335
Mar ’25