Apologies that this is probably a simple problem.
I've started from a sample code provided by Apple and changed it quite significantly. However, I'm not able to Archive the app.
The original visionOS sample code has the same issue, so hopefully someone will be able to spot the problem:
https://developer.apple.com/documentation/visionos/creating-stereoscopic-image-in-visionos
The problems shown in the log are:
Undefined symbol: _main
Linker command failed with exit code 1 (use -v to see invocation)
The first error seems to say that there's no "main" but there is indeed a @main in the EntryPoint.swift file.
Any ideas? I have archived other apps (built from scratch) successfully, but clearly there's something different about this sample code.
Many thanks!
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
why xcode has no option to fold all
Topic:
Developer Tools & Services
SubTopic:
Xcode
I encountered this issue with an app I'm writing that accepts arguments. With some troubleshooting I've determined that this is an inherent behaviour in how Xcode 16 compiles SwiftUI apps and how macOS 15 launches them.
The issue:
Launching the app as open /Applications/AppName.app --args --arg1 --arg2 --arg3 etc should allow the app to process the arguments as CommandLine.arguments and this is still the case. How the app sees arguments is unchanged and doesn't matter if you use CommandLine.arguments or swift argument parser or don't have arguments at all. This will affect any SwiftUI app as I'll demonstrate below.
The problem is that if you use a mix of arguments as --arg value pairs or --arg as a flag, then depending on the order the arguments are provides, the app won't launch properly. The icon will appear in the dock but no window appears until you click the icon in the dock. (BTW, having "Application is agent (UIElement)" set to YES in the Info.plist makes this task rather difficult.)
In testing if you use all flags, it's fine. if the flags are in pairs, it's fine. if you have one flag and then a --arg value pair, you will see the issue. If you reverse the order so the flag is after then it works fine.
How to replicate:
On macOS 15 and Xcode 16
Open Xcode
Create a new macOS App (called demoapp in my example)
Select SwiftUI as the interface
Build
That it. Don't add anything and just build the boilerplate hello world app that Xcode makes for you. Once that's built, cd to your /Build/Products/Debug/ directory in terminal and try the following (this happens if you build for release as well):
note, the app window will display when you click the icon in the dock, just not on initial launch
# three single arguments
open ./demoapp.app --args --foo --bar --baz
# App window displays as expected
# one single argument, one arg value pair
open ./demoapp.app --args --foo --bar baz
# The app window will not appear.
# same arguments as before but the single argument is after the arg value pair
open ./demoapp.app --args --bar baz --foo
# App window displays as expected
# arg[1] without `-` or `--` prefix
open ./demoapp.app --args foo --bar --baz
# The app window will not appear.
# arg[1] and arg [2] without prefix
open ./demoapp.app --args foo bar --baz
# The app window will not appear.
# single - in front of the first two arguments
open ./demoapp.app --args -foo -bar baz
# The app window will not appear.
# single - in front of the first three arguments
open ./demoapp.app --args -foo -bar -baz bob
# App window displays as expected
No idea what is going on but I suspect macOS does some pre-processing before launching the app, for example you can do stuff like open /Applications/SomeApp.app --args -AppleLanguages '(de)' to run using a specific language. I presume the OS is pre-processing arguments before launching the app proper.
If I compile the app using Xcode 15.4 then this issue is not present. Also Apps compiled with Xcode 16 do not exhibit the issue on macOS 14 or earlier. It's a specific Xcode 16, macOS 15 thing in the way the app is compiled that makes it behave this way.
I hope I've explained it correctly, but it's very easy to replicate. I filed a feedback for it (under a different apple account), FB15577018.
Any insight into what's going on here would be helpful. Also if there's any compiler flags I could be setting. In my actual project, I'm not making any other changes. The same code compiled under Xcode 16 (.0 or .1RC) behaves differently to Xcode 15.4.
Topic:
Developer Tools & Services
SubTopic:
Xcode
import SwiftUI
struct viewdetail: View {
@State var text1:String = ""
@State var tip1:String = ""
@State var text23:String = ""
@State var tip23:String = ""
var body: some View {
Text(text1);Text(tip1);Text(text23);Text(tip23)
}
}
func detailLine(costa:inout [Double],tipa:inout [Double]) {
print(costa,tipa)
text1 = "125" cannot find 'text1' in scope
print("detail")
}
func delete(costa:inout [Double],tipa:inout [Double],number: inout Int) {
print(costa,tipa)
tipa.removeLast()
costa.removeLast()
number -= 1
print(costa,tipa)
}
#Preview {
viewdetail()
}
Does anyone know why I'm getting "cannot find text1 in scope"?
Topic:
Developer Tools & Services
SubTopic:
Xcode
After updating to Xcode 26 Beta 4, I can no longer upload my app to App Store Connect due to a WatchKit icon validation error.
The error states:
Invalid Icon. The watch application 'YourApp.app/Watch/YourWatchApp.app' contains an icon file 'Icon Image-AppIcon-watch-1024x1024 @1x.png' with an alpha channel. Icons should not have an alpha channel.
• This file name doesn’t exist in the asset catalog or project source.
• All icon assets used in the Watch App’s AppIcon set, including the required 1024x1024 icon, were checked with sips -g hasAlpha and confirmed to not contain an alpha channel.
• Project was cleaned, derived data cleared, and archive recreated multiple times.
• This issue only began after updating to Xcode 26 Beta 4. In the previous versions, everything was ok.
Is anyone else experiencing this after upgrading Xcode to Beta 4? Any idea/workaround on how to solve this would be appreciated.
Comments are not displayed correctly in Xcode 16. As you can see on the included screenshot, the first /// are displayed correctly but the remaining ////////////////////////// are super small.
In a programming text editor, like Xcode, all characters MUST be monospaced. Otherwise it is impossible to code. Xcode is not supposed to be a word processor.
There are no parameters to fix that. It was working fine for the past 15 years on Xcode. Please fix that so I can work again. And never do that ever again. Understood?
Topic:
Developer Tools & Services
SubTopic:
Xcode
We use a local swift package in 6 of our app extensions. The product from the local package that we link to each app extension is a dynamic framework. And while the dynamic framework is copied into the final app bundle once, the resource bundles of each target that comprise the dynamic framework is copied into each app extension. I'd much rather have the bundles be copied into the dynamic framework once to prevent app bloat.
Here is a visualization of the issue:
.
└── MyApp.ipa/
├── MyApp (executable)
├── MyDynamicFramework_TargetA.bundle
├── MyDynamicFramework_TargetB.bundle
├── MyDynamicFramework_TargetC.bundle
├── Frameworks/
│ └── MyDynamicFramework.framework/
│ ├── TargetA
│ ├── TargetB
│ └── TargetC
└── PlugIns/
├── Widgets.appex/
│ ├── MyDynamicFramework_TargetA.bundle
│ ├── MyDynamicFramework_TargetB.bundle
│ └── MyDynamicFramework_TargetC.bundle
├── Intents.appex/
│ ├── MyDynamicFramework_TargetA.bundle
│ ├── MyDynamicFramework_TargetB.bundle
│ └── MyDynamicFramework_TargetC.bundle
├── IntentsUI.appex/
│ ├── MyDynamicFramework_TargetA.bundle
│ ├── MyDynamicFramework_TargetB.bundle
│ └── MyDynamicFramework_TargetC.bundle
├── NotificationContent.appex/
│ ├── MyDynamicFramework_TargetA.bundle
│ ├── MyDynamicFramework_TargetB.bundle
│ └── MyDynamicFramework_TargetC.bundle
├── RichPushContent.appex/
│ ├── MyDynamicFramework_TargetA.bundle
│ ├── MyDynamicFramework_TargetB.bundle
│ └── MyDynamicFramework_TargetC.bundle
└── NotificationService.appex/
├── MyDynamicFramework_TargetA.bundle
├── MyDynamicFramework_TargetB.bundle
└── MyDynamicFramework_TargetC.bundle
Notice that the resource bundles of Target A, B, and C are copied multiple times causing an unhealthy app size.
I'd either like the resource bundles to be copied into MyDynamicFramework or copied once into the app bundle and let the app extensions reference them.
Given the SPM + Xcode linking is a black box for the most part, how would I accomplish this?
Hi, run into this error today: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.QJh2l0/extracted/MyAwesome.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)
Project is an AUv3 app + extension. It builds and install fine on MacOS.
It builds on iPad but can't install : that's when the error appears.
Regarding provisioning files, I use Automatic manage signing and I can see that the Xcode Managed Profile looks fine an includes my iPad.
The only thing I see that differ from other projects is that as an AUv3 project, I have both and App (host) and extension projects. Thus the bundle identifier for this extension project is not the same as it seems I have to use different identifiers.
So app bundle id is x.y while extension is x.y.z (same x.y base))
Last but not least the project and IPA can be built fine on XCode Cloud. (Although I can't download the artifacts but it seems it's the same problem for many of us today...)
macOS Version 15.4 (Build 24E248)
Xcode 16.2 (23507) (Build 16C5032a)
Thanks in advance for your help :)
Happy to have a new MacBook Pro M4 now - the new machine was setup from time machine backup of my old MacBook Pro M1.
Sadly Predictive Code Completion does not work on the new M4 (it was working great on the M1).
Xcode shows as downloaded component:
Predictive Code Completion Model [com.apple.fm.code.generate_small_v1.base: 500.1.81600.13.200772,0] [com.apple.fm.code.generate_safety_guardrail.base: 1.6.81619.13.200716,0] [com.apple.gm.safety_deny.input.code_intelligence.base: 32024010.20241007.171244.100.377,0] [com.apple.gm.safety_deny.output.code_intelligence.base: 32024010.20241007.171244.100.377,0] (Installed)
Things I already tried:
Removed and reinstalled Xcode 16 (also latest beta).
Disabled/enabled Xcode Editor Settings for predictive code completion
Many many reboots
Removed Xcode cache
Maybe the downloaded Model is somehow locked to the old machine?
How can I remove, redownload or reinstall it again?
Thank you very much.
Tobias
I tried to monitor the device's network status with Network framework code below.
let networkMonitor = NWPathMonitor(requiredInterfaceType: .cellular)
networkMonitor.pathUpdateHandler = { [weak self] path in
if path.status == .satisfied {
print("Cellular Satisfied")
} else {
print("Cellular Unsatisfied")
}
}
When I run the app in my iPhone(iOS 15.5) and turn cellular on/off, iPhone suddenly loses connection with XCode.
Lost connection to the debugger on “...'s iPhone”.
Domain: IDEDebugSessionErrorDomain
Code: 12
Recovery Suggestion: Restore the connection to “...'s iPhone” and run “...” again, or if “...” is still running, you can attach to it by selecting Debug > Attach to Process > ....
User Info: {
DVTErrorCreationDateKey = "2022-06-23 02:16:30 +0000";
IDERunOperationFailingWorker = DBGLLDBLauncher;
}
Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
"device_model" = "iPhone13,2";
"device_osBuild" = "15.5 (19F77)";
"device_platform" = "com.apple.platform.iphoneos";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 2;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 5861;
"operation_errorCode" = 12;
"operation_errorDomain" = IDEDebugSessionErrorDomain;
"operation_errorWorker" = DBGLLDBLauncher;
"operation_name" = IDEiPhoneRunOperationWorkerGroup;
"param_consoleMode" = 0;
"param_debugger_attachToExtensions" = 0;
"param_debugger_attachToXPC" = 1;
"param_debugger_type" = 5;
"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_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" = 0;
"param_launcher_substyle" = 0;
"param_runnable_appExtensionHostRunMode" = 0;
"param_runnable_productType" = "com.apple.product-type.application";
"param_runnable_swiftVersion" = "5.6";
"param_runnable_type" = 2;
"param_testing_launchedForTesting" = 0;
"param_testing_suppressSimulatorApp" = 0;
"param_testing_usingCLI" = 0;
"sdk_canonicalName" = "iphoneos15.4";
"sdk_osVersion" = "15.4";
"sdk_variant" = iphoneos;
}
In my opinion, it seems like an error of XCode. Plz let me know if there's any solution.
Also, there's a similar issue here : https://developer.apple.com/forums/thread/681459
Ever since I updated to Xcode 16.2, no device running iOS 18 shows up in Xcode. I can see the devices in Finder and Apple Configurator, but not in Xcode. When I run xcrun devicectl list devices, I also do not see the devices, so I assume the issue is in CoreDevice somewhere.
I've tried many things I've seen suggested in similar threads (toggling developer mode, reinstalling Xcode, using a different physical cable, etc) and so far nothing has helped. This same behavior is also happening for my entire development team, which has been as difficult as you might imagine.
Any info on how to resolve this would be much appreciated.
I updated today at Xcode 16 beta 6, and my app using SwiftData on iOS 18 (beta 6) is getting now this new error when saving the model in the modelContext.
I don't understand if it is a regression introduced in the beta 6 or if it is enforced something that previously wasn't.
It seems to be always referred to the ID property, for example:
SwiftData/ModelCoders.swift:1762: Fatal error: Passed nil for a non-optional keypath \MyModel.id
In this case (and in most of the cases in my models) the ID is defined as following
@Attribute(.unique)
public var id: UUID
I also tried to add the initialization inline, but didn't help
@Attribute(.unique)
public var id: UUID = .init()
I also tried to remove the @Attribute(.unique), didn't help as well.
Does any of you have the same issue?
Fails to gather code coverage and throws this error
Showing All Messages
Failed to merge raw profiles in directory /Users//Library/Developer/Xcode/DerivedData/Receiver-ekqrbpsaciuxmlfslviajhoecyat/Build/ProfileData/0B0C6B69-FD46-4801-B106-56B7FCD44370 to destination /Users//Library/Developer/Xcode/DerivedData/Receiver-ekqrbpsaciuxmlfslviajhoecyat/Build/ProfileData/0B0C6B69-FD46-4801-B106-56B7FCD44370/Coverage.profdata: Aggregation tool '/Users/shwethamugeraya/Downloads/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata' failed with exit code 1: warning: /Users/shwethamugeraya/Library/Developer/Xcode/DerivedData/Receiver-ekqrbpsaciuxmlfslviajhoecyat/Build/ProfileData/0B0C6B69-FD46-4801-B106-56B7FCD44370/2F4EFBF7-1CCF-4E9E-8FD6-482EEDB98B6C-34646.profraw: raw profile version mismatch: Profile uses raw profile format version = 4; expected version = 8
PLEASE update this tool to version in the raw profile, or regenerate raw profile with expected version.
error: no profile can be merged
Despite Xcode being the one and most used IDE for iOS, it is far from perfect. I have used many tools in my career and here are some features, that would make it much better or what I miss from other IDEs. I encourage others to chip in discussion and lets all hope, Apple starts to improve Xcode. Will put each issue in separate comment below.
Slow debugger: not sure what bloat Xcode has or what it is doing, but sometimes it can take more than 10 seconds from breakpoint firing to actually see values. Moreover when debugging SwiftUI or something objC I have to drill down to see value of property or use po and p command and hope it works. SwiftUI views and states are a big pain to debug, to see what is changing a value I have to always use didSet trick or some other black magic. Is it too hard to make it easier? Breakpoints with condition can take up to 1 minute to load and I have M1 Max MBP. Just tried cursor IDE few days ago and breakpoints are much faster and without too much bloat in variable inspector.
Topic:
Developer Tools & Services
SubTopic:
Xcode
I just noticed this today while building a React Native app.
Anybody else seen this and know what it means/how to track it down/how to fix it
Hi there -
I maintain the react-native-apple-authentication module which allows react native developers to implement sign in with Apple
When testing we noticed that code working perfectly in iOS17 Simulators now fails on iOS18/18.1 Simulators. Specifically, the credential status is always revoked when testing on an iOS18+ Simulator.
The same code works perfectly on a real device running iOS18 or 18.1 so this appears to be a Simulator bug.
This is problematic because App review is frequently performed on a Simulator, so there are false-negative test results for Sign In With Apple from reviewers when they use iOS18 emulators, resulting in App submission rejections.
We're tracking this here, with some results posted and an example app in-repo that demonstrates the issue:
https://github.com/invertase/react-native-apple-authentication/issues/356
It would be great to see the Simulator fixed so that it works correctly with Sign In With Apple again. Thanks
Under Xcode 26 beta 3 I'm trying to build a project which uses Metal. I've installed the Metal Toolchain 26.0 under Settings -> Components, but when I start a build it fails during the "Prepare build" step with the following error (repeated many times):
stat(/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.5276.7.Pb9SLL/Metal.xctoolchain/usr/bin/clang): No such file or directory (2)
I've confirmed that there is in fact no 'clang' binary in that directory. I've tried using xcode-select to set the Xcode 26 Beta app as the active developer directory, and xcodebuild -version shows:
Xcode 26.0
Build version 17A5276g
Any ideas on other things to try?
Will RC be allowed to upload to App Store Connect?
I have tried a couple of times with 17A321 and I keep getting unsupported SDK or Xcode version.
Submitted feedback FB20178551
Is it just because it's still so early or are we not getting the feature in the EU for the time being?
Topic:
Developer Tools & Services
SubTopic:
Xcode
I'm currently setting up a new build environment.
Our old build server was a small M1 Mac Mini set up to build our, up-to-now, only app.
Since we now have a second app (and probably more to come) and have some issues building all on the same mac (gem versions, flutter versions, etc.) I now set up a virtualized build environment.
I'm currently running a MacOS 15 beta 3 VM on a M2 Mac Mini also on MacOS 15 beta 3.
The VM has all basic tools inside, including Xcode 16 beta 3 and is logged in with our AppleID for our build server.
The VM is spun up with a non-persistent storage before the build, installs the gem's/flutter in the correct version, checks out the code and builds it.
Now I'm getting an error on the build, that I have to select a development team, but he team is already selected and the build is working fine on the old M1 Mac Mini.
It is suggested to login to Xcode, so I logged in to Xcode in the VM, which itself was successful, but when loading the teams I'm getting the following error:
Decoding Error
There was a failure decoding response: (HTTP 401, 60 bytes)
The data couldn't be read because it isn't in the correct format..
The account info is correct, it's the same account that is logged in to MacOS and it's the same account from the old build system.
I guess this somehow has to do with the MacOS VM (before MacOS 15 it was not possible to signin to an apple id, this is also the reason why I use the beta).
Is there any chance to fix this and get it working?
We are not able to use Xcode cloud builds (or any other cloud services) due to corporate policies.
We are also not able to buy a dedicated Mac Mini for every app (too expensive and too much time needed for maintenance).