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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Created

XCode problem
Right now, I am trying the tutorial for SwiftUI from the Apple Developer Program inside of Xcode, but I encountered a problem. Inside of the selectable canvas mode in Xcode, I wanted to command-control-click the element (in this case, a text) to bring up the editing popover and select "Show SwiftUI Inspector." For some reason, on the popover menu, the only option was "Embed." I only wanted the menu point Show SwiftUI Inspector, and I also tried the shortcut Ctrl+Option, but nothing worked. Now is there another method to get to this menu? Or can you help me with that? Noah
1
3
102
Oct ’25
Communication with Apple failed
‘Your team has no devices from which to generate a provisioning profile. Connect a device to use or manually add device IDs in Certificates, Identifiers & Profiles. https://developer.apple.com/account/ Xcode couldn't find any tvOS App Development provisioning profiles matching ’ I followed the instructions and created it manually, but it still doesn't work. Why is that? I remember it used to be created automatically and take effect right away.
3
0
128
Oct ’25
ToolbarItem with .hidden() or .opacity(0) leaves a visible frame when built with Xcode 26 (worked fine in Xcode 16.4)
In Xcode 16.4, I could hide a ToolbarItem simply by applying .hidden() or .opacity(0), and the button disappeared completely — including its touch area and layout space. However, when I build the same code with Xcode 26, the button visually disappears but its frame and tap area remain, as if the ToolbarItem were still present but invisible. This causes an empty tappable area to remain in the toolbar. Here’s a simplified example: .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Back") { // action } .opacity(isSelectionMode ? 0 : 1) // or .hidden() – both produce the same issue } ToolbarItem(placement: .principal) { Text("Title") } ToolbarItem(placement: .topBarTrailing) { Button("Select") { isSelectionMode.toggle() } } } Expected behavior (Xcode 16.4):  When isSelectionMode becomes true, the Back button disappears completely and its space in the toolbar is released. Actual behavior (Xcode 26):  The Back button becomes invisible, but its tappable area and layout spacing remain, leaving an empty spot in the toolbar. To work around this, I tried conditionally including the ToolbarItem only when isSelectionMode == false, like this: @ToolbarContentBuilder private var toolbarLeadingContent: some ToolbarContent { if !isSelectionMode { ToolbarItem(placement: .topBarLeading) { Button("Back") { } } } } However, this approach fails to build when the minimum deployment target is iOS 15, showing the compiler error: 'buildIf' is only available in iOS 16.0 or newer I understand that @ToolbarContentBuilder relies on buildIf internally for conditional branches, which explains the limitation, but this means there’s currently no iOS 15–compatible way to completely remove a ToolbarItem at runtime. So my questions are: Is the layout change in Xcode 26 an intentional behavior change in SwiftUI? What’s the correct way to fully remove a ToolbarItem on iOS 15–compatible projects without using buildIf?
0
0
80
Oct ’25
Xcode 26.1 RC issue
I'm seeing a lot of unexpected CPU usage when running the iOS 26.1 simulator. Looks like a "MercuryPosterExtension" is crashing over and over, which then causes the "ReportCrash" process to run, presumably to create the crash report. Doesn't happen on device, nor on iOS 26.0 simulator. I suspect MercuryPoster is related to wallpaper. I also don't see any wallpaper background in my simulator. Few lines from the stack trace: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libxpc.dylib 0x18011defc _xpc_api_misuse + 88 1 libxpc.dylib 0x18012e16c _xpc_shmem_create_with_prot.cold.1 + 24 2 libxpc.dylib 0x180113a70 _xpc_shmem_create_with_prot + 276 3 MTLSimDriver 0x23795ed48 -[MTLSimDevice newBufferWithLength:options:pointer:copyBytes:deallocator:] + 260 4 MercuryPosterExtension 0x10081d21c 0x100758000 + 807452 13 PosterKit 0x240d003d8 -[PRRenderer scene:willConnectToSession:options:] + 648 14 UIKitCore 0x1856bcf18 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 956
30
30
3.8k
Oct ’25
Xcode26.1 compile error: cannot execute tool 'metal' due to missing Metal Toolchain
When I use Xcode26.1 or Xcode26.0.1 compile my project, Xcode failed with error error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain. I search around and found this is a known issue and fixed in Xcode26, but I get this error in latter versions. I tried all the methods in documents(https://developer.apple.com/documentation/xcode-release-notes/xcode-26-release-notes) to intall Metal component, but it still compile error with the same error. I also delete Xcode and all related components restart computer and reinstall Xcode26.1, it's not work also. macOS version: 26.0.1 (25A362) Xcode version: 26.1 MetalToolchain version: 17.0 (17B54)]
1
0
145
Oct ’25
CompileAssetCatalogVariant failed with nonzero exit code.
I'm running in a very very very weird error. I have a large asset catalog, consisting of about 2700 assets for 1.19GB of size. I can successfully build and run my project with both release and debug scheme, when a real device or simulator is selected. However, whenever I select Any iOS device (arm64), about 80ish seconds in the build process, the building fails with the following output: CoreUI: Error: unable to add asset to store *** Terminating app due to uncaught exception 'IBPlatformToolFailureException', reason: 'The tool closed the connection (AssetCatalogSimulatorAgent) What I tried and failed: Cleaning DerivedData and restarting PC Building the same project on three different devices, each with a different version of XCode. All failed. running sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService Scanning for duplicate image files, found none. Scanning for duplicate .imageset folders in different folders, found none. Scanning for images that declared a different format than theirs, eg .webp renamed as .png, and found none. Creating an empty Hello World project, and just adding my asset catalog. Build fails for Any iOS device, succeeds for simulator or physical device. Uninstalling and reinstalling XCode command line tools. Manually compiling via actools. Changed "Embed Assets Pack in Product Bundle" from No to Yes. I don't have any .svg file in my assets. What I tried and failed but gives more insight: Now the only thing that I was able to come up with was deleting folders to narrow down where the problem was. So I found that there is a 700MB folder called T, containing T1, T2, ..., T6. Eventually managed to narrow down even more to T3, T4, T6. I created a distinct .xcassets catalog for each subfolder and tried to compile individually with actools, along with assets.xcassets (the main one). Here's the thing: T3.xcassets + assets.xcassets compiles T4.xcassets + assets.xcassets compiles T6.xcassets + assets.xcassets compiles T3.xcassets + T4.xcassets + assets.xcassets compiles. T3.xcassets + T6.xcassets + assets.xcassets compiles. T4.xcassets + T6.xcassets + assets.xcassets compiles. T3.xcassets + T4.xcassets + T6.xcassets + assets.xcassets crashes with CoreUI: Error: unable to add asset to store. I've been stuck for days now and can't deploy my finished app I worked on for the last three years because of this.
6
0
255
Oct ’25
Regarding the Deployment Targets setting for Xcode 26
Our project plans to upgrade Xcode from 16.2 to Xcode 26. We’ve noticed that the information on https://developer.apple.com/support/xcode/ states that the Deployment Targets for Xcode 26 supports iOS 15–26.1. However, the Deployment Targets for our current project is set to iOS 13. Does this mean that we must set the project’s Deployment Targets to iOS 15 or higher if we want to upgrade to Xcode 26? Can we still set the Deployment Targets to iOS 13? If we upgrade to Xcode 26 and set the Deployment Targets to iOS 13, will there be any problems?
2
0
147
Oct ’25
XCPreviewAgent crashes with KERN_PROTECTION_FAILURE on macOS 26.0.1 Tahoe
Hello, I'm experiencing consistent crashes of XCPreviewAgent when using Xcode Previews on macOS 26.0.1 Tahoe (25A362). Configuration: macOS: 26.0.1 (25A362) - stable release Xcode: 16.0 (23.0.54) - stable release Hardware: MacBook Pro M4 Project: SwiftUI iOS app Issue: Every time I try to use Xcode Previews, XCPreviewAgent crashes with: Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000340e54000 Termination Reason: Namespace SIGNAL, Code 10, Bus error: 10 The crash occurs in shared memory region during dynamic library loading. What I've tried: Cleared all caches: rm -rf ~/Library/Developer/Xcode/DerivedData Deleted Preview data: rm -rf ~/Library/Developer/Xcode/UserData/Previews Reset simulators: xcrun simctl --set previews delete all Switched xcode-select to /Applications/Xcode.app/Contents/Developer Tried both Xcode stable and Xcode beta Created fresh simulators Clean build (Cmd+Shift+K) Rebooted Mac multiple times The app runs fine on simulator (Cmd+R), but Previews consistently crash.
1
0
90
Oct ’25
Xcode 16.4
Hi I have downloaded Xcode 16.4 with MacOS Sequoia 15.7.1 as a XIP. It has downloaded but only as a 5GB file and it won't show up in my privacy settings/or even in storage- can someone tell me what I am doing wrong please- I know it should be about 50GB. Thank you
1
0
52
Oct ’25
Xcode 26.0.1 launch fails with error "Loading a Plugin Failed."
Hi All, I have recently upgraded my Silicon Mac Laptop from MacOS 15.3 (Sequoia) to MacOS 26 (Tahoe). Since existing Xcode 16.2 is not compatible with MacOS 26, i installed Xcode 26.0.1 but after the successful installaton the application is not working and quits after the erorr dialog "Loading a Plugin Failed." (Screenshot attached). I tried resatring/reinstalling the Xcode 26.0.1 but no luck. To narrow down the issue i installed the same Xcode 26.0.1 in another Silicon Mac laptop with MacOS 26(Tahoe) where no previous Xcode was installed and it went well and working as expected. With my assumption Xcode 26.0.1 breaks when the device is upgraded from sequoia to Tahoe due to some conflicting old Xcode settings/files which may not be compatible with Xcode 26 or Tahoe but i am not sure. I followed some old articles as below from the forum and nothing worked for me so far. https://developer.apple.com/forums/thread/660860 https://developer.apple.com/forums/thread/719810 https://developer.apple.com/forums/thread/759396 Can some one shed a light on this to resolve this issue? Thanks.
0
0
72
Oct ’25
iOS Enterprise App Build Showing “Requires iOS 26.0” Even Though Deployment Target Set to iOS 18.0
We’re facing an issue when trying to install an enterprise-distributed iOS app on devices running iOS 18.5. During installation, we receive this error message: “This iOS app requires a newer version of iOS. You need to update this iPhone to iOS 26.0 to install this app.” However, in Xcode 26.0.1, our app’s minimum deployment target is explicitly set to iOS 17.6. After adding this step and the app result is unable to install the app on ios 18.5 and message getting as per the above quotes. Kindly help me out this issues.
0
0
75
Oct ’25
Xcode 26.0 Share Extension crashes with NSInternalInconsistencyException on iOS 26.0
Issue : When creating a new project in Xcode 26.0 and adding a Share Extension target without modifying any code, the app crashes upon displaying the extension screen with the following error: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The layout constraints still need update after sending -updateConstraints to <_UINavigationBarTitleControl: 0x105b9cc00; frame = (0 0; 0 0); layer = <CALayer: 0x10b834270>>. _UINavigationBarTitleControl or one of its superclasses may have overridden -updateConstraints without calling super. Or, something may have dirtied layout constraints in the middle of updating them. Both are programming errors.' Environment : Xcode 26.0 iOS 26.0 (physical device) Note: This issue does not occur when running on iOS 18.3.1 (physical device). Temporary Workaround : Adding the following implementation to the isContentValid method prevents the exception from occurring: Objective-C- (BOOL)isContentValid { // Do validation of contentText and/or NSExtensionContext attachments here if (@available(iOS 26, *)) { self.navigationController.navigationBarHidden = YES; } return YES; } Questions : Is there any alternative way to avoid this exception? Since this crash occurs with the default implementation generated by Xcode, is there any plan to fix it in future updates?
7
1
463
Oct ’25
I'm currently using macOS 26 and Xcode 26, but I'm unable to download iOS 26 simulators.
Download failed. Domain: DVTDownloadableErrorDomain Code: 41 User Info: { DVTErrorCreationDateKey = "2025-10-26 06:59:38 +0000"; } Download failed. Domain: DVTDownloadableErrorDomain Code: 41 Failed fetching catalog for assetType (com.apple.MobileAsset.iOSSimulatorRuntime), serverParameters ({ RequestedBuild = 23A8464; }) Domain: DVTDownloadsUtilitiesErrorDomain Code: -1 Download failed due to a bad URL. (Catalog download for com.apple.MobileAsset.iOSSimulatorRuntime) Domain: com.apple.MobileAssetError.Download Code: 49 User Info: { checkConfiguration = 1; } System Information macOS Version 26.0.1 (Build 25A362) Xcode 26.0.1 (24229) (Build 17A400) Timestamp: 2025-10-26T17:59:38+11:00
16
2
833
Oct ’25
Persistent MTLCommandQueue.h Corruption (dispatchType missing) Despite macOS Erase & Reinstall (Xcode 26.0.1 / macOS 26.0.1)
Hello Developers and Apple Engineers, I am encountering a persistent and highly unusual Xcode build failure when trying to use Metal APIs, specifically related to MTLCommandQueueDescriptor. I have exhausted all standard troubleshooting steps, including a complete erase and reinstall of macOS, yet the issue remains. Hardware diagnostics have passed. I am seeking insights or potential solutions. The Problem: When compiling any project (including brand new, empty macOS App projects) that attempts to set the dispatchType property on an MTLCommandQueueDescriptor instance, the build fails with the following errors: Swift // Code causing the error: let queueDescriptor = MTLCommandQueueDescriptor() queueDescriptor.dispatchType = .userInteractive // <-- Error occurs here // Compiler Errors: Value of type 'MTLCommandQueueDescriptor' has no member 'dispatchType' Cannot infer contextual base in reference to member 'userInteractive' Key Evidence - Physical Header File Corruption: The root cause appears to be a physically corrupted/incomplete SDK header file. Using the cat command in Terminal to inspect the contents of the relevant Metal header file confirms that the definition for MTLCommandQueueDescriptor is missing the dispatchType property: Bash cat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Metal.framework/Versions/A/Headers/MTLCommandQueue.h The output consistently shows MTLCommandQueueDescriptor only having maxCommandBufferCount and logState properties, even after a fresh OS and Xcode installation. Environment: macOS: Version 26.0.1 (Build 25A362) - Clean install via Erase and Reinstall from Recovery. Xcode: Version 26.0.1 (Build 17A400) - Installed fresh from Mac App Store after OS reinstall. Mac Hardware: MacBook Pro (14-inch, M3) - (Please confirm this model info is accurate) Hardware Diagnostics: Passed (Tested at an official Apple Store). Exhaustive Troubleshooting Steps Performed (Issue Persists After All): Standard Xcode Cleaning: Clean Build Folder (Shift+Cmd+K). Manually deleted DerivedData folder (~/Library/Developer/Xcode/DerivedData). Deleted Xcode Caches (~/Library/Caches/com.apple.dt.Xcode, com.apple.dt.xcodebuild). Command Line Tools Path: Correctly set using sudo xcode-select -s /Applications/Xcode.app/Contents/Developer. Verified path using xcode-select -p. Verified version using xcodebuild -version. Multiple Xcode Versions & Install Methods Attempted (Before OS Reinstall): Xcode 26.0.1 (App Store). Xcode 26.0.1 (.xip package from Developer Portal). Xcode 26.1 Beta 3 (.xip package from Developer Portal). Performed thorough cleaning (deleted ~/Library/Developer, /Library/Developer, caches, rebooted) before each .xip installation attempt. In all cases, cat command confirmed the header file remained corrupted on disk after installation. Hardware Check: Took the Mac to an official Apple Store. Hardware diagnostics passed without any issues reported. Complete OS Reinstallation: Booted into Recovery Mode. Used Disk Utility to completely erase the internal SSD (APFS, GUID Partition Map). Reinstalled macOS 26.0.1 from Recovery. Set up the Mac as a new device (did not restore from backup). Post-OS Reinstall: Installed Xcode 26.0.1 fresh from the Mac App Store. Set command line tools path correctly. Created a brand new macOS App project (MetalTest). Pasted the minimal code to reproduce the issue into AppDelegate.swift. Build failed with the exact same errors. Ran the cat command again, confirmed the MTLCommandQueue.h file on the fresh system is STILL missing the dispatchType property. Request for Help: Given that the SDK header file corruption persists even after a complete macOS erase and reinstall, and hardware diagnostics have passed, I am at a loss for the cause or further troubleshooting steps. Has anyone encountered a similar situation where core SDK files remain corrupted despite a clean OS install and passing hardware checks? Are there any deeper system caches or states that might survive an erase/reinstall and interfere with SDK file integrity? Are there any more advanced diagnostic steps recommended? Any insights or suggestions from Apple engineers or the community would be greatly appreciated. Thank you. I have previously contacted Apple Developer Support regarding this issue, case ID: 102731239935.
0
0
90
Oct ’25
Unable to launch tests in Xcode 26
I am trying to upgrade my app to use Xcode 26 and I cannot get my tests to launch. I am trying to launch tests to the simulator, and I always get this error after 300 second timeout: "encountered an error (The test runner hung before establishing connection.)" There are no other errors getting logged. I can run to the same simulator just fine, and in Xcode 16 the tests launch with no issues. The tests also run fine on an actual iPhone. Thanks in advance.
6
0
242
Oct ’25
How can I remove a localization from a String Catalog in a Swift Package?
Hello, I'm trying to remove a localization from a String Catalog in a Swift Package. How can I do that? I tried to remove the file and create a new one, but all the languages are back. The only place where I've found a reference to the languages is in Package/.swiftpm/xcode/package.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate But I don't know how to edit this file to remove a language. Thank you, Axel
2
0
138
Oct ’25