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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

xcodebuild -exportLocalizations Fails Due to Cross-Platform Dependencies
I'm working on a large multi-platform iOS project (iOS, iPadOS, watchOS, tvOS, visionOS) and have successfully migrated from legacy .strings files to modern String Catalogs (.xcstrings). However, I'm unable to export localizations using xcodebuild -exportLocalizations due to cross-platform framework dependency issues. (Note: I did have AI help me write this question, so apologies in advance for any errors) Project Structure Main iOS/iPad app with multiple extensions watchOS companion app tvOS app visionOS app 49 .xcstrings files successfully migrated across all targets Uses Swift Package Manager for modularization The Problem When attempting to export localizations using xcodebuild -exportLocalizations, the build fails because it tries to build all targets across all platforms, including watchOS targets that depend on third-party xcframeworks that don't include watchOS slices: xcodebuild -exportLocalizations \ -project MyProject.xcodeproj \ -scheme MyApp \ -localizationPath ./export \ -configuration Debug Error: error: While building for watchOS, no library for this platform was found in 'Frameworks/<incompatible>.xcframework'. (in target 'Target') These frameworks cannot be modified to add watchOS support (third-party/legacy dependencies). What Works vs. What Doesn't Works: Building the iOS app through Xcode GUI Fails: Exporting localizations through Xcode GUI (Product → Export Localizations...) Fails: xcodebuild -exportLocalizations with any combination of flags Attempted Solutions (All Failed) Platform-specific destination: xcodebuild -exportLocalizations -destination "generic/platform=iOS" ... SDK constraint: xcodebuild -exportLocalizations -sdk iphoneos ... Excluding architectures: xcodebuild -exportLocalizations EXCLUDED_ARCHS="armv7k arm64_32" ... Build first, then export: xcodebuild build -scheme MyApp -sdk iphoneos && \ xcodebuild -exportLocalizations ... All approaches still attempt to build watchOS targets despite platform constraints. Observations The -exportLocalizations flag appears to ignore -destination and -sdk flags It seems to scan and build ALL schemes/targets in the project regardless of constraints Regular builds (xcodebuild build) work fine with platform constraints Current Workaround I created a Python script that parses .xcstrings JSON files directly and generates XLIFF output, which works but feels like it's bypassing Apple's intended workflow. Questions for Apple Is there a way to limit xcodebuild -exportLocalizations to specific platforms? The documentation doesn't mention any flags for this, and -destination/-sdk appear to be ignored. Why does -exportLocalizations require building ALL targets across ALL platforms? Both the Xcode GUI (Product → Export Localizations) and xcodebuild -exportLocalizations fail with identical build errors, suggesting this is by design. Is there a reason localization export can't be limited to buildable targets? Is the intended workflow to have ALL targets buildable across ALL platforms before exporting localizations? This seems impractical for multi-platform projects with platform-specific dependencies. Are there any build settings or configuration options that can exclude specific targets/platforms from the localization export scan? Is directly parsing .xcstrings files and generating XLIFF an acceptable alternative, or does this miss important metadata that -exportLocalizations would include? Environment Xcode 16.x / 26.x (reproduces on both) macOS Tahoe Project uses String Catalogs (.xcstrings) format Mixed SPM packages and traditional target structure Any guidance on the correct approach for multi-platform localization export would be greatly appreciated. Is this a known limitation, or is there a recommended pattern I'm missing?
5
0
178
2w
Stage Manager app icon in Xcode 26 macOS apps
Adding icons to Xcode macOS apps using Icon Composer is easy, the icon shows up in the Dock and in the About dialog right away. Yet, after many years struggling with other ways to add icons, I was hoping the new method in macOS 26 and Xcode 26 would finally make the icons show up in Stage Manager as well. Alas, nothing I tried, including killing a lot of things, rebooting while holding my tongue at the right angle, etc, did not help. I do have some new macOS Xcode project apps that show the icon properly in Icon Manager, generated with Icon Composer, yet other apps never show their icon in Icon Composer, no matter what voodoo I try. Forums online yield no solutions to this common problem.
1
0
95
2w
The tunnel connection failed while the system tried to connect to the device.
Hello, I’m new to macOS after many years on iPhone, and I’m trying to run a simple app on my iPhone directly from Xcode. The app builds fine in the simulator, but deploying to a real device fails with this error: The tunnel connection failed while the system tried to connect to the device. Domain: com.apple.dt.CoreDeviceError Code: 4 Failure Reason: The tunnel connection failed while the system tried to connect to the device. User Info: { DVTErrorCreationDateKey = "2025-10-02 16:55:53 +0000"; "com.apple.dt.DVTCoreDevice.operationName" = connect; } -- The tunnel connection failed while the system tried to connect to the device. Domain: com.apple.dt.RemotePairingError Code: 4 -- I get the same error via command line, e.g. for xcrun devicectl device info apps --device "..." My setup: macOS Version 26.0.1 (Build 25A362) Xcode 26.0.1 (Build 17A400) iPhone 13 on iOS 26.0.1 iPhone is paired with the Mac (I can see it in Finder and in Xcode alongside the simulator). Developer Mode is enabled on the iPhone. I also see my Apple Watch listed in Xcode. I might have enabled Multipath networking in the past - but in iOS 26.0.1, the setting is missing in the Developer settings - so there is no way to check if it's enabled or to disable it. I know this was the solution to a similar problem: https://developer.apple.com/forums/thread/737907 What I tried: Restarted both Mac and iPhone, unpaired them, paired them again. Disabled and re-nabled development mode Tried both Wi-Fi and wired connection (Apple-certified cable). Reset privacy and network settings on the iPhone. Verified I’m not running any VPN. Despite this, deployment always fails with the same tunnel connection error. Has anyone encountered this before or found a solution/workaround? Thank you very much, Martin
0
1
112
2w
tvOS 26 - AVPlayer.preventsDisplaySleepDuringVideoPlayback not working
Hi guys, after updating to tvOS 26 it is not possible to disable screensaver using AVPlayer.preventsDisplaySleepDuringVideoPlayback. We are streaming TV programs continuously and when player is in full creen we disable screensaver by setting preventsDisplaySleepDuringVideoPlayback = true When leaving player screen and navigating to Home or EPG where player continues to play in the background we set preventsDisplaySleepDuringVideoPlayback = false to enable screen saver in which case after set time screensaver activates. Disabling screensaver appears to be working only when starting the app for the first time, but when making the first transition out of the player and calling preventsDisplaySleepDuringVideoPlayback = false for the first time, then any subsequent change of preventsDisplaySleepDuringVideoPlayback to true has no effect. Result is that player is playing in full screen, but after set period (e.g. 2 minutes) screen saver activates, which is very bad user experience making TV app unusable. I tried using Xcode 26 and targetting tvOS 17 and higher. I installed Xcode 16.4 and rebuilt the app, but I see the same problem with screensaver. Xcode 16.4 and tvOS 17 target worked before. It appears to be related to tvOS 26 not to SDK itself. Is there perhaps a new API to disable screensaver? Is preventsDisplaySleepDuringVideoPlayback obsolete or could it be intention to disallow developers disabling screensaver? Do we need to notify all users to set screensaver time to higher value or Never if they want to watch TV for all day without touching remote? Not sure if it is a bug in tvOS 26 or purposely changed behavior. Does anybody know? Thanks.
3
0
110
2w
XCode 26: is it possible to remove the preinstalled iOS Platform via xcodebuild?
Hi, as described by the subject, I'm trying to find a way to remove the preinstalled iOS support via command line tool. I need to do that because I need to use the universal architectureVariant in order to build on old Intel-based iOS Simulators, but on iOS 26. As described in this page, I can use this command to download the architecture I need xcodebuild -downloadPlatform iOS -architectureVariant universal however, launching this command I receive this error iOS is already downloaded as arm64Only. To replace with universal, first delete the existing one. Is there any way to remove the current installed iOS platform via command line? In particular I'm serching for a way to do what the button "Delete" in the attached screen does. Thank you
1
1
116
2w
XCode app testing on iPhone fills in iPhone storage
I run some tests for an iOS app, connecting the iPhone to my mac where the code resides. I notice that it fills the iPhone from system data, until the iPhone is full. I tried everything to remove the system data (I assume some logs from the XCode testing): reset network, restart the iPhone, remove the tested app, etc. Nothing works. I am stuck with having to erase all data on the iPhone and reinstall from scratch, which is very tedious. Any suggestions ? Thanks!
0
0
66
2w
Xcode 26 on macOS 26 with a Dark theme in Light Mode
Is anyone else using one of the "Dark" editor themes (such as "Default (Dark)" or "Classic (Dark)" in Xcode? And is anyone doing this with Xcode 26 on macOS 26? Here's the result while using the "Default (Dark)" theme while my Mac is in "light" mode: Note that the black background of the editor goes all the way to the far left edge of the Xcode window. The large gray area in the project tree is the black background bleeding through the sidebar. This is really distracting. Is there a way to fix this (besides not using a dark theme - I've been using dark themes for over 30 years)? This appears to be a poor design decision in macOS 26 to have split views show the background of the secondary column behind the primary column. iPadOS 26 has the same issue (see https://developer.apple.com/forums/thread/800073).
0
0
80
2w
Ensure that macOS-only SwiftPM project main & test source builds via swift, xcodebuild & Xcode
I want to ensure that the main & test source of my macOS-only SwiftPM project (on GitHub at mas) builds via swift, xcodebuild & Xcode. For builds of clean clones of the main branch (i.e. no locally edited files, no existing .build or .swiftpm folders, etc.): The swift command line below builds main & test fine: swift build --build-tests The xcodebuild command line below doesn't seem to run the SwiftPM MASBuildToolPlugin (which generates a Swift file necessary for the build), which is setup for the project in Package.swift, so neither main nor test build: xcodebuild -scheme MAS -destination "platform=macOS,arch=$(arch),variant=macos" How can I get xcodebuild to run my MASBuildToolPlugin, or to run an equivalent? In Xcode, building main works fine, so Xcode must run the SwiftPM MASBuildToolPlugin. Building test, however, fails with the following error: No such module 'MAS' If I capitalize the name of the executable in the following line in Package.swift from: products: [.executable(name: "mas", targets: ["MAS"])], to: products: [.executable(name: "MAS", targets: ["MAS"])], Then Xcode can compile the tests. That, however, sets the generated executable file's name to MAS, but I want it to be mas. How can I use MAS for the package/module/target/etc. names in the source, but generate an executable file named mas? I obviously can rename the executable after it has been generated by running mv MAS mas, but would the upper-case name be incorrectly used anywhere inside the executable? I assume not. Also, I'd prefer to setup my project properly, instead of using a file renaming hack.
0
1
100
2w
Xcode 26, Pull Requests support
Does anyone have problems with the Pull Request functionality in Xcode 26 RC? I can’t create a new pull request inside Xcode (it always redirects me to the web page). I can’t see changes within an existing pull request (I only see the PR name; I can’t even approve it or request changes). I’ve had this problem since beta 1 of Xcode 26. Does anyone know how to fix this?
1
1
123
2w
Does Xcode 26 Still Support Pull Requests?
Does Xcode 26 still support creating pull requests and/or viewing comments from GitHub pull requests associated with the current branch? This used to be possible, but I cannot get it to work with the current version of Xcode (26.0.1). The "Create Pull Request" menu item takes me to github.com directly, instead of presenting a nice UI menu; hence I'm wondering.
1
2
76
2w
Xcode_26 not compiling Metal project
Hello Xcode 26.0.1 (17A400) Missing some Metal components When building a program using Metal, it induces an unexpected error : “error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain Command CompileMetalFile failed with a nonzero exit code” Which terminates the build The fix given “xcodebuild -downloadComponent MetalToolchain” using sudo does not work Did someone find a work around or could resolve the issue? Many thanks Jean MacBook Air M4; macOS 26.0.1; Xcode 26.0.1
1
1
162
2w
watchOS app with @Published properties fails to compile in Xcode 26.0.1 - "missing import of defining module 'Combine'
I'm developing a watchOS companion app for my iOS app in Xcode 26.0.1 on macOS Sequoia. The watch app uses a simple ObservableObject class with @Published properties for state management, which compiles fine for iOS but fails for the watchOS target. Error: Initializer 'init(wrappedValue:)' is not available due to missing import of defining module 'Combine' Code: swiftimport SwiftUI import WatchConnectivity import Combine // Added explicitly class WatchConnectivityProvider: NSObject, ObservableObject { @Published var distance: Double = 0 @Published var isActive: Bool = false // Additional @Published properties... } Environment: Xcode 26.0.1 (17A400) macOS Sequoia watchOS deployment target: 11.0 Apple Watch Series 11 running watchOS 11.6.1 What I've tried: Adding import Combine explicitly Cleaning build folder Verifying target membership This same code pattern works in the iOS target Is @Published / Combine supported differently in watchOS under Xcode 26? This code worked in previous Xcode versions. What's the recommended approach for observable state in watchOS apps with Xcode 26?
0
1
58
2w
AppIntents don't show up in Shortcuts app when in SPM package
Hi there, I successfully created an AppIntent for our app, and when I had it in the same target as our main app it showed up fine in the shortcuts app. Then I realized that many of the new System Control widgets introduced in iOS 18 (e.g. lockscreen, control center) live in the widget extension target, but they also need to reference that same AppIntent. So to fix this, I thought I'd migrate out the code into it's own SPM package that both the WidgetExtension and the Main App processes can reference. However, after doing that and rebuilding, the intent no longer shows up in the Shortcuts app. Furthermore, my AppShortcutsProvider class now has this error when trying to define the list of appShortcuts: App Intent <name> should be in the same target as AppShortcutsProvider Is this intended, and if so, how do we reference the same AppIntent across multiple targets?
16
2
3.9k
2w
App crashing on launch on Test Flight
My app is crashing on Launch in Test Flight and Console only gives me the information below which doesn’t tell me what I need to fix in my app for it to stop crashing. I’ve looked at the Documents available and I didn’t find them helpful. How can I find out what I need to fix in my app? Any help would be greatly appreciated! • Unhandled JS Exception: TypeError: undefined is not a function (Hermes) • *** Terminating app due to uncaught exception 'RCTFatalException' → SIGABRT • UIKit/setRootViewController: shows up in the native backtrace
0
0
62
2w
Xcode's Coverage is broken since 16.2
The coverage of a lot of modules inside our iOS App, not all of them. it appears to be broken since Xcode 16.2 There are some reports over internet without any fix https://www.reddit.com/r/iOSProgramming/comments/1jnzgxw/tests_coverage_not_visible_on_xcode_162/ there's an error message in the logs: raw profile version mismatch: Profile uses raw profile format version = 8; expected version = 10 Xcode 26 didn't fix the issue as well
1
0
25
2w
"Build input file cannot be found" error occurs in Archive.
"Build input file cannot be found" error occurs in Archive. When running Archive to generate a build file, the build file generation fails with a "Build input file cannot be found: ..." error. When debugging, the build runs fine on the actual device without any errors. Comparing and modifying the Build Settings with other projects doesn't fix the issue. Deleting the Swift file and attempting to Archive results in a crash due to the missing file. Even after deleting and adding the Swift file, the same error persists when attempting to Archive. Even after deleting and re-adding the Swift file, the issue persists even after deleting all DerivedData file space on my Mac and restarting Xcode. Can you help me with this issue? It worked fine before the recent macOS update, and I successfully archived and published it to the App Store a few days ago. I believe this issue occurred after updating macOS to 26.0.1. My Xcode version is 26.0.1.
1
0
57
2w
Xcode 15 performance tests ignore baseline
I'm trying to write performance tests with Xcode 15, but it's not working: even though setting a baseline seems to work (baseline data files are created), Xcode seems to ignore that baseline altogether whenever the test is run. As a result, performance tests never fail, no matter how bad performance gets. The source editor persistently displays a “No baseline average for Time” message. Has anyone else encountered this? Figured out how to sidestep the issue? Of note, the issue is easily reproduced: create a new (macOS in my case) app project with tests, add a dummy performance test; run the test once and save its baseline, and despite this subsequent tests will always succeed, even if you significantly slow the dummy test down. (I've filed this as FB13330139)
11
10
2.7k
2w
XIB Files line seperator = none not be respected in iOS 26.1 ONLY
Hey All, Curious if you guys are seeing the same thing for those who are using Interface Builder Files (Xib) i set the line seperator to none and on my app (built against ios 18 on the app store, but doesnt matter if i build it against ios 26, or ios 26.1) when running on iOS 26.1 the line seperator will show even when i set it to None. Funny enough if i just play around with the XIB file and set it to single line and maybe RED color the IB file will show it but when running it its the same old default dark greyish color. BUT if i set the line seperator in CODE either to be none or with single line + red it looks good when running on sim / device. So it seems to be an issue with XIB files not being respected in iOS 26.1 (only) i have submitted a feed back FB20466783, hope this helps any xcode devs / uikit devs. thank you !
1
0
89
2w