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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Could Not Launch Mac (Designed for iPad) App in Xcode
I get the following message when I try to run this app in Xcode. Could not launch AppName. Runningboard has returned error 5. Please check the system logs for the underlying cause of the error. Interestingly, the destination Mac (Mac Catalyst) destination does launch. The funny thing is there is a companion app almost exactly like this one that launches fine. Any help with this would be greatly appreciated. Xcode helped me to file a feedback. The number is FB13206919.
8
1
3.2k
Sep ’23
Xcode 15 not finding iOS 17 devices
I have a brand new iPhone 15 with iOS 17, paired with a watch on WatchOS10. In devices and simulators, the iPhone 15 and Watch 10 device show up as disconnected (with the globe icon I think is what it is?) and if I click on either of them, that icon changes to a spinner, and the main window says "Xcode will continue when the operation completes", but it NEVER completes. This makes the device not usable for development. In addition, I have updated my iPad to iOS17, and it doesn't even show up at all in the devices and simulator list, even though it is enabled for developer mode. I have toggled developer mode off and on (thus rebooting). I have quit and restarted Xcode. I have even rebooted the Mac. Nothing helps. This is incredibly frustrating.
10
2
6.7k
Sep ’23
Xcode 15's "Replace Container" feature replaces the container with incorrect permissions?
I recently updated to Xcode 15.0 and seem to be encountering permissions related errors after using the Replace Container function to replace an app container. Similarly, editing the current run scheme and choosing a new App Data container fails with an identical error. It seems like the Documents directory and other similar directories are blocked from being able to write. Here is an example of what appears in the log after replacing the container: Failed to create directory /var/mobile/Containers/Data/Application/A3C32E7A-34F3-4C69-B037-478027F2A4AC/Library/Preferences because of 13. Couldn't write values for keys ( "/google/measurement/app_instance_id" ) in CFPrefsPlistSource<0x280a82760> (Domain: com.google.gmp.measurement, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): Directory needed os_unix.c:47395: (13) lstat(/private/var/mobile/Containers/Data/Application/A3C32E7A-34F3-4C69-B037-478027F2A4AC/Documents) - Permission denied os_unix.c:47395: (13) lstat(/private/var/mobile/Containers/Data/Application/A3C32E7A-34F3-4C69-B037-478027F2A4AC/Documents/<redacted>.sqlite) - Permission denied os_unix.c:46898: (13) statfs(/private/var/mobile/Containers/Data/Application/A3C32E7A-34F3-4C69-B037-478027F2A4AC/Documents/<redacted>.sqlite) - Permission denied Steps to reproduce: Create a new app and replace -viewDidLoad: with the following. This will write a string to a new file and read that string: NSFileManager * const fileManager = [NSFileManager defaultManager]; NSURL * const documentsDirectoryURL = [[fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; if (!documentsDirectoryURL) { [NSException raise:@"DocumentsDirectoryException" format:@"Application documents directory URL is nil"]; } NSURL * const fileURL = [documentsDirectoryURL URLByAppendingPathComponent:@"test.txt"]; if ([fileManager fileExistsAtPath:[fileURL path]]) { NSError *error; if (![[NSFileManager defaultManager] removeItemAtPath:[fileURL path] error:&error]) { [NSException raise:@"DocumentsDirectoryException" format:@"Encountered error removing file: %@",error]; } } NSString * const fileContents = [NSString stringWithFormat:@"Date: %@",[NSDate date]]; NSError *error; if (![[fileContents dataUsingEncoding:NSUTF8StringEncoding] writeToURL:fileURL options:0 error:&error]) { [NSException raise:@"DocumentsDirectoryException" format:@"Encountered error writing to file: %@",error]; } NSString * const writtenFileContents = [[NSString alloc] initWithData:[NSData dataWithContentsOfURL:fileURL] encoding:NSUTF8StringEncoding]; NSLog(@"Written file contents: %@", writtenFileContents); Run the app and observe the log message "Written file contents: ..." Save the app container via Window > Devices & Simulators by clicking the app, clicking the "(...)" button, and then clicking "Download Container..." Use the same procedure in step 3 but instead, click "Replace Container..." and choose the existing app container that was downloaded Run the app again and observe that it fails with the following exception message: *** Terminating app due to uncaught exception 'DocumentsDirectoryException', reason: 'Encountered error writing to file: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “test.txt” in the folder “Documents”." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/CF1E09C8-7BE2-4D87-8AD2-648AFBE038A5/Documents/test.txt, NSUnderlyingError=0x2831d4d50 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}' Is anyone else encountering this issue and can confirm? Are my next steps to create a bug report? Is there a manner to escalating the bug report? This is a pretty core piece of functionality for QA and testing apps.
30
7
8.9k
Sep ’23
Why does Tap Gestures not work in Immersive View?
Hello, here is my coding for the immersive view of Xcode Beta SwiftUI VisionPro when I first create a new project. struct ImmersiveView: View { @Environment(\.openWindow) var openWindow var body: some View { RealityView { content in // Add the initial RealityKit content if let immersiveContentEntity = try? await Entity(named: "Immersive", in: realityKitContentBundle) { content.add(immersiveContentEntity) // Add an ImageBasedLight for the immersive content guard let resource = try? await EnvironmentResource(named: "ImageBasedLight") else { return } let iblComponent = ImageBasedLightComponent(source: .single(resource), intensityExponent: 0.25) immersiveContentEntity.components.set(iblComponent) immersiveContentEntity.components.set(ImageBasedLightReceiverComponent(imageBasedLight: immersiveContentEntity)) // Put skybox here. See example in World project available at // https://developer.apple.com/ } } .onLongPressGesture { openWindow(id:"A") } } } I have just added a tap gesture to the immersive view because all I want is to test and see if it opens a window by tapping anywhere on the screen in the simulator. Unfortunately, the tapping does not work but the tap gestures works in a normal window group. Please explain to me why tap gestures don't work in immersive views? I need some help. If gestures do work then can you send me the updated code with the working gesture. Thank you.
3
0
1.3k
Sep ’23
Unable to connect Xcode 15 to iPhone (Error: developer disk image could not be mounted)
I am suddenly unable to connect to my iPhone (running iOS 17.0) in Xcode (either 15 or the last 15 beta). I get this error: The developer disk image could not be mounted on this device.. Error mounting image: 0xe8000115 (kAMDMobileImageMounterDevicePropertyQueryFailure: Failed to query device property.) I am able to see the disk image iOS_DDI.dmg in the Finder by opening /Users/cmonsour/Library/Developer/DeveloperDiskImages/ I have restarted both computer and iPhone, re-enabled Developer Mode, cleared Derived Data. I am not running a VPN. I am running the latest Xcode. I upgraded from Ventura to Sonoma with no improvement. Any help appreciated. Unable to run anything from Xcode on my iPhone now, which is quite frustrating. Details are as follows: The developer disk image could not be mounted on this device. Domain: com.apple.dt.CoreDeviceError Code: 12040 Failure Reason: Error mounting image: 0xe8000115 (kAMDMobileImageMounterDevicePropertyQueryFailure: Failed to query device property.) User Info: { DDIPath = "/Users/cmonsour/Library/Developer/DeveloperDiskImages/iOS_DDI.dmg"; DVTErrorCreationDateKey = "2023-10-01 18:33:29 +0000"; DeviceIdentifier = "A4E1792C-1396-4BAF-A1E1-73C19F9FB8A4"; IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; NSURL = "file:///Users/cmonsour/Library/Developer/DeveloperDiskImages/iOS_DDI.dmg"; Options = { MountedBundlePath = "file:///private/var/tmp/CoreDevice_DDI_Staging_501/A4E1792C-1396-4BAF-A1E1-73C19F9FB8A4/"; UseCredentials = 0; }; "com.apple.dt.DVTCoreDevice.operationName" = enablePersonalizedDDI; } -- Error mounting image: 0xe8000115 (kAMDMobileImageMounterDevicePropertyQueryFailure: Failed to query device property.) Domain: com.apple.mobiledevice Code: -402652907 User Info: { FunctionName = AMDeviceRemoteMountPersonalizedBundle; LineNumber = 2108; } -- Failed to initialize remote device attributes: 0xe8000115 (kAMDMobileImageMounterDevicePropertyQueryFailure: Failed to query device property.) Domain: com.apple.mobiledevice Code: -402652907 User Info: { FunctionName = "-[PersonalizedImage mountImage:]"; LineNumber = 1772; } -- Failed to retrieve personalization identifiers: 0xe8000115 (kAMDMobileImageMounterDevicePropertyQueryFailure: Failed to query device property.) Domain: com.apple.mobiledevice Code: -402652907 User Info: { FunctionName = "-[PersonalizedImage initializeRemoteDeviceAttributes:]"; LineNumber = 1367; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_model" = "iPhone14,5"; "device_osBuild" = "17.1 (21B5045h)"; "device_platform" = "com.apple.platform.iphoneos"; "dvt_coredevice_version" = "348.1"; "dvt_mobiledevice_version" = "1643.2.4"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 173097; "operation_errorCode" = "-402652907"; "operation_errorDomain" = "com.apple.dt.CoreDeviceError.12040.com.apple.mobiledevice"; "operation_errorWorker" = IDEInstallCoreDeviceWorker; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 99; "param_launcher_substyle" = 8192; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos17.0"; "sdk_osVersion" = "17.0"; "sdk_variant" = iphoneos; } -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.0 (22265) (Build 15A240d) Timestamp: 2023-10-01T14:33:29-04:00
20
2
16k
Oct ’23
Xcode 15 compiling and running even simple code slowly.
Hey all, I started a class and the first assignment was, as expected, to print “Hello World” on a Swift Playground. The issue I’m coming across is that Xcode 15 runs and compiles, even one line of code, excruciatingly slowly. When I’d messed with Xcode on Monterey and Ventura it wasn’t giving me nearly as many slowness issues as Sonoma does now. I’m using an M1 Air with 8GB RAM. I know that isn’t much, but it should be sufficient. I’d read before that it wants to simulate iOS 17 on an iPhone 15 Pro Max by default, but I don’t know how to change that if it is in fact what the problem is. Thanks in advance for your help.
7
1
1.7k
Oct ’23
devicectl appIcon command not working
Hi, I'm trying to use the appIcon command of devicectl. I'm connecting to an iPhone 14 Pro running iOS 17.0.2. xcrun devicectl device info appIcon --help OVERVIEW: Request app icon generation from this device. This command searches for an app installed on this device and requests for its icon to be generated. USAGE: devicectl device info appIcon [<options>] --device <uuid|ecid|udid|name> --allow-placeholder <allow placeholder> --width <width> --height <height> --scale <scale> DEVICE OPTIONS: -d, --device <uuid|ecid|udid|name> The identifier, ECID, UDID, or name of the device. COMMAND OPTIONS: --app-bundle-id <app bundle identifier> Look for app icon information with the given application bundle identifier on device. Note: If both app-bundle-id and app-path are provided, only app-path will be used. --app-path <app path> Look for app icon information at the given application path on device. Note: If both app-bundle-id and app-path are provided, only app-path will be used. --allow-placeholder <allow placeholder> Allow placeholder icons to be generated. Note: Passing `true` will allow placeholder icons to be returned. Allowing placeholder icons will ensure no I/O is done on device. If you want to make sure you get the icon most accurate to your request -- which could use more resources on the device -- set this to `false`. --width <width> Request app icon generation with the specified width. --height <height> Request app icon generation with the specified height. --scale <scale> Request app icon generation with the specified scale. --destination <destination> Write the image (in png format) to the provided file on the host device. OUTPUT OPTIONS: -v, --verbose If given, provide more logging output than normal. -q, --quiet If given, output will include only errors. -t, --timeout <seconds> The overall command timeout in seconds. If this limit is exceeded the command is abandoned as a failure. -j, --json-output <path> An optional path to write a JSON file with command results. Note: JSON output to a user-provided file on disk is the ONLY supported interface for scripts/programs to consume command output. -l, --log-output <path> An optional path to write all logging otherwise passed to stdout/stderr. OPTIONS: --version Show the version. -h, --help Show help information. I've tried multiple variations of parameters and both apple-bundle-id and app-path, but always receive an error. xcrun devicectl device info appIcon --device *** --app-bundle-id *** --app-path *** --allow-placeholder true --width 60 --height 60 --scale 3 --destination icon.png -j icon.json -t 10 -v With JSON output "error" : { "code" : 6007, "domain" : "com.apple.dt.CoreDeviceError", "userInfo" : { "NSLocalizedDescription" : { "string" : "CGImage was nil when attempting to write to a destination." } } }, Without JSON output 09:32:42 Acquired tunnel connection to device. 09:32:42 Enabling developer disk image services. 09:32:42 Acquired usage assertion. Application Icon Image Information • Is Placeholder - false • Size • Height - 0.0 • Width - 0.0 • Scale - 0.0 • Pixel Size • Height - 0.0 • Width - 0.0 Has anyone managed to successfully extract an app icon using devicectl?
4
0
1.4k
Oct ’23
App crash that build with xcode 15 on ios 13.7, errror #3 0x000000010e5508d4 in ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) ()
I need some help on some crash issues on the app that I build with Xcode15. I previously encountered compatibility issues with various real iPhone models when using Xcode 14, hence I upgraded xcode 14 to 15 and resolved the compatibility issues. Even the build is success, however the app crashes when it launch on iphone XS with the error: errror #3 0x000000010e5508d4 in ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (). It doesn’t appear to be related to my local C++ code. I googled on that, some threads recommend me to do clean build, delete .xcodeproj and regenerate xcodeproj, restart xcode, unchecked thread sanitizer etc etc. But I tried that, problem still persist. I wonder does anyone know what can cause the problem? xcode version: xcode15 psychical Iphone model: iphone XS ios version : 13.7
5
1
3.0k
Oct ’23
Unknown Type Issue
Building any C projects in Xcode is giving me the following unknown type errors. I tried this with the basic C project hello world template to ensure it was happening with all C projects. I am currently on Sonoma 14.0 and running Xcode 15.0 Any ideas on how to resolve these errors?
2
1
466
Oct ’23
framework 'CoreAudioTypes' not found
Issue I have made a framework, which is mixed with Swift and Objective-C. In the Objective-C Code, I have imported header of CoreAudioTypes as: #import <CoreAudio/CoreAudioTypes.h> Using CocoaPods, when integrating the framework as open source code, it works fine. When integrating as closed source, a compiled library, Xcode produces an error saying: framework 'CoreAudioTypes' not found Validation I created a brand new project, with nothing in it except the template code. In the TARGETS -> GENERAL -> Frameworks, Libraries, and Embedded Content, I added CoreAudioTypes.framework Eventually, Xcode produced the same error framework 'CoreAudioTypes' not found So I wonder it may be an issue of Xcode? If not, how can i solve it? Thanks! Xcode Version 15.0, installed from App Store
6
2
8.0k
Oct ’23
visionOS simulator broken on Intel macBook since upgrade to Sonoma
On my macBook Pro 2019 with Intel processor, I could run apps in the visionOS simulator without any problems when I was running macOS Ventura. But since I upgraded the Mac to Sonoma, the visionOS simulator seems to be broken. The display in Xcode sticks to "Loading visionOS 1.0", and the simulator page under "Devices and Simulators" says "No runtime". This is independent of which Xcode version I am using. I used Xcode 15 beta2, but also tried out more recent versions. Could it be that developing on Intel Macs was dropped on macOS Sonoma without any notice? I can see that the Xcode 15.1 specs state you need a Silicon Mac, but the Xcode 15 specs don't. And it worked for me, at least on Ventura. The "only" change I made since was upgrading the OS to Sonoma.
3
2
1.7k
Oct ’23
Please, restore VisionOS simulator for Intel-based Macs.
Just a few days ago, I found the following notes for the visionOS 1 beta 4 Simulator: This includes the simulator runtime for visionOS. The simplest way to install the visionOS simulator runtime is by using Xcode. Xcode can automatically install it when you build a project or start a new one. To manually add this simulator to Xcode, read Installing Additional Simulator Runtimes. Note: Developing for visionOS requires a Mac with Apple silicon. I'm currently the proud owner of an Intel-based iMac 2019, 27", updated to the latest MacOS version, and which works wonderfully, flawlessly. And I paid handsomely for it. And now, if I am ever going to continue working on any projects related to VisionOS, I'm going to have to shell extra money (a bit less than what I paid for my current setup) for a machine that will be marginally better than my actual one. While I do realize there must be technical reasons why Apple Silicon-based machines perform better than Intel-based ones for VisionOS development, I still can't help but notice that, until a week ago, these machines worked almost correctly - there were some bugs, but they weren't showstoppers. And I'm pretty sure these bugs can be fixed. So, I do not really understand why do you guys want to make this move to stop supporting Intel-based Macs from doing VisionOS dev. It will only force people to purchase machines that they do not need, to make the apps that they want to do, leaving perfectly working machines as if they were useless (which, I cannot state strongly enough, THEY WORK PERFECTLY.) Dear Apple: Please, do not force us to buy new Macs to do our work. Please, allow us to have the VisionOS Simulator on our existing machines, and let us experience any problem that the Simulator has in our machines by ourselves, and then make the decision to get newer hardware at our pace. It should be our decision, not yours. Please, restore the VisionOS Simulator, bugs and all, and let us decide by ourselves. Feel free to decide whether it is worth to fix the current bugs at your own pace, but please, do not forbid us from doing our job with our current machines.
12
15
4.2k
Oct ’23
Export Localization Build failing with Macros
Recently we introduced a macro to our workspace. Builds fine inside Xcode, as well as builds fine using xcodebuild. Seemed like everything was working perfectly until we went to export localizations. If we attempt to do it from Xcode itself it will fail as it attempts to build macOS (which is a totally different issue) We have this process automated though so it is being built via command line: This is the exact prompt we're running xcodebuild -exportLocalizations -localizationPath ../output -workspace <workspace>.xcworkspace -exportLanguage en -sdk iphoneos This will do the normal Xcode package/build graph resolution and generation and begin building. Eventually when it hits a use case of the macro it will fail. In each case when it fails it will have something like this: <unknown>:0: warning: compiler plugin not loaded: '<output-path>/<our-macro-package>; failed to initialize <path-to-usage>.swift:29:35: error: external macro implementation type '<our-macro-package>.<our-macro>' could not be found for macro '<our-macro>()' If I go to that output path I can see the macro package executable there. If I look in the build command for the file I can something that looks like this: ... -load-plugin-executable <output-path>/<our-macro-package>\#<our-macro-package> ... If attempt to build, without the -exportLocalizations flag, it works and builds just fine. I'm not sure what's happening here. Has anyone seen this? Macros+export localizations?
5
1
886
Oct ’23