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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

SwiftUI Preview + Swift Packages Break App
I have a multi-platform app with the SwiftUI code a separate Swift Package. Any Views with SwiftUI Previews break the compilation of the app. Here's the error message I get in Xcode: Showing All Messages ld: warning: Could not parse or use implicit file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it Undefined symbols for architecture arm64_32: "(extension in SwiftUI):DeveloperToolsSupport.Preview.init(_: Swift.String?, traits: DeveloperToolsSupport.PreviewTrait<DeveloperToolsSupport.Preview.ViewTraits>..., body: @Swift.MainActor @Sendable () -> SwiftUI.View) -> DeveloperToolsSupport.Preview", referenced from: static BitnessViews.$s12BitnessViews33_ABDBADF565C741E50A2A5746CE94FCD9Ll7PreviewfMf_15PreviewRegistryfMu_.makePreview() throws -> DeveloperToolsSupport.Preview in BitnessViews.o ld: symbol(s) not found for architecture arm64_32 clang: error: linker command failed with exit code 1 (use -v to see invocation) Could not parse or use implicit file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it Undefined symbol: (extension in SwiftUI):DeveloperToolsSupport.Preview.init(_: Swift.String?, traits: DeveloperToolsSupport.PreviewTrait<DeveloperToolsSupport.Preview.ViewTraits>..., body: @Swift.MainActor @Sendable () -> SwiftUI.View) -> DeveloperToolsSupport.Preview Linker command failed with exit code 1 (use -v to see invocation) Any thoughts as to what might be going on here?
0
0
29
2h
Pay attention to StoreKit Configuration settings
It's not a question, I just want to share my experience of resolving a bug. We where adding a new product to the app and couldn't get why it's not loading. StoreKit 2 simply did not return the product, so we switched to StoreKit 1 to get invalidProductIdentifiers from the response. The product was there of course. So many time was spend... We checked App Store configuration, everything was approved. Checked id, localization, multiple devices. Everyone start to get mad, we filled issues for RevenueCat and Apple. Then we uploaded a TF build (because product wasn't loading when running from Xcode). And, suddenly the product did appear there! I understood that it can be connected to StoreKit Configuration, since it works only in debugger mode (Debug or Release), but not in TF. But there was no any .storekit files in the project folder. I search it many times - no success. And finally the bug was resolved when I checked Run Scheme. As you can see on the screenshot, it has red value under StoreKit Configuration. That means there where a file before, but than it was removed. So I changed it to None and the product started to work in debug. Great! I hope this post helps, don't fall to the same error as me! Related article: Setting up StoreKit Testing in Xcode
0
0
43
5h
Unable to Simulate Messages and Sticker Packs
I'm on a fresh install of MacOS (14.5) with a fresh install of the latest XCode (15.4) and when I create a new Messages app or Sticker Pack, it compiles but fails to deploy on the simulator. (This is the default project configuration provided by Xcode with no changes.) I have tried reinstalling Xcode and the simulators but nothing fixes it. I've tried also changing the device to simulate but it still doesn't work. Regular applications however do deploy on the simulator and work as normal. But Messages and Sticker Packs do not show up on the simulator in the messages app and give the following errors: objc[3958]: Class CKDetailsTUConversationCell is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/ChatKit.framework/ChatKit (0x1ecbe7280) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Applications/MobileSMS.app/MobileSMS (0x102cd2920). One of the two will be used. Which one is undefined. mkdir: path=/var/mobile/tmp/com.apple.messages/ mode= -rwx------: [2: No such file or directory] mkdir: path=/var/mobile/tmp/com.apple.messages/ mode= -rwx------: [2: No such file or directory] setAllowableTypes_block_invoke:1242: *** CGImageSourceSetAllowableTypes - ignoring unknown: 'public.avci' Received Connection Invalid mkdir: path=/var/mobile/tmp/com.apple.messages/ mode= -rwx------: [2: No such file or directory] Synchronous remote object got an error attempting to post setup, reason: Couldn’t communicate with a helper application. [com.apple.MobileSMS:A23DA686-547E-4980-B6EF-F33F6A7A637E] Error when getting current app configuration for action identifier ConversationListFocusFilterAction, error='Error Domain=DNDErrorDomain Code=1007 "No current action is available. Supply the caller with the default." UserInfo={NSLocalizedDescription=No current action is available. Supply the caller with the default.}' Calling -viewWillAppear: directly on a view controller is not supported, and may result in out-of-order callbacks and other inconsistent behavior. Use the -beginAppearanceTransition:animated: and -endAppearanceTransition APIs on UIViewController to manually drive appearance callbacks instead. Make a symbolic breakpoint at UIViewControllerAlertForAppearanceCallbackMisuse to catch this in the debugger. View controller: <CKSearchViewController: 0x10406d800> Invalid absolute dimension, must be > 0.0. NOTE: This will be a hard-assert soon, please update your call site. Invalid absolute dimension, must be > 0.0. NOTE: This will be a hard-assert soon, please update your call site. Invalid absolute dimension, must be > 0.0. NOTE: This will be a hard-assert soon, please update your call site. Invalid absolute dimension, must be > 0.0. NOTE: This will be a hard-assert soon, please update your call site. XPC error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.coreduetd.knowledge was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.coreduetd.knowledge was invalidated: failed at lookup with error 3 - No such process.} Synchronous remote object got an error attempting to post setup, reason: Couldn’t communicate with a helper application. Duet query failed: Couldn’t communicate with a helper application. UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once. failed to create XPC connection Unknown invokeXPCSynchronousCallWithBlock error: Error Domain=TransparencyErrorXPC Code=-108 "failed to create XPC connection" UserInfo={NSLocalizedDescription=failed to create XPC connection} Error registering for delegate callbacks. Error: Error Domain=SKStatusSubscriptionErrorDomain Code=-4000 "System iCloud account does not exist or is not statuskit capable" UserInfo={NSDebugDescription=System iCloud account does not exist or is not statuskit capable} Error retrieving subscription for handle. Error: Error Domain=SKStatusSubscriptionErrorDomain Code=-4000 "System iCloud account does not exist or is not statuskit capable" UserInfo={NSDebugDescription=System iCloud account does not exist or is not statuskit capable} handle: <SKHandle: 0x600000024150; handleString = "+18885551212"> Error fetching subscription service for handle: "+18885551212" Error: Error Domain=SKStatusSubscriptionErrorDomain Code=-4000 "System iCloud account does not exist or is not statuskit capable" UserInfo={NSDebugDescription=System iCloud account does not exist or is not statuskit capable} Checked bag access permission -- allowed? YES {hasMachAccess: YES, hasEntitlements: YES} API MISUSE: Resuming an NSURLSessionTask with nil URL. Task <525FCF57-436C-4CEE-9A83-DC62606B01E5>.<1> finished with error [-1002] Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x600000c86460 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <525FCF57-436C-4CEE-9A83-DC62606B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <525FCF57-436C-4CEE-9A83-DC62606B01E5>.<1>" ), NSLocalizedDescription=unsupported URL} unhandled process MobileSMS Requested keyboard snapshot but UIKeyboard.usesInputSystemUI returned NO. Failed to get pid info for pid 0: Operation not permitted Failed to get pid info for pid 0: Operation not permitted mkdir: path=/var/mobile/tmp/com.apple.messages/ mode= -rwx------: [2: No such file or directory]
1
0
36
13h
ContentView
Hello, I‘ve started developing an App not to long ago on Xcode and I have noticed that I can’t see any progress or like preview of what I have coded so far and it’s starting to concern me. I have Xcode version 15.5 and I am coding with swift, everything works fine there is no error or anything preventing it to run but when I try to preview the only thing I see when I launch the Simulator and I open my app the only thing I see is a white page. Can someone please help me.
2
0
65
16h
Xcode Organizer Crashes "Last Day" filter not working
The "Last Day" filter in the crashes section of the Xcode Organizer, never has any crashes in it. If we use the "Last Two Weeks" filter, then you can clearly see that we do have crashes every day. They even show crashes for yesterday in the little graph in the "statistics" window. So why dont they show up in the last day filter? Is there some hidden setting we don't have enabled? This also seems related to the fact that the number of crashes from "yesterday" is always incomplete. i.e. waiting another day makes the number go up, implying not all crashes were included in the original number. This means we have to wait two days to get the data from one day ago. Why?
1
0
69
21h
Xcode 16 Beta 2. iOS 18 Simulator Biometrics Issue
Hi, I am trying to achieve biometric authentication in iOS 18 Simulator but getting the below error. The same things works in iOS 17.2 simulator in the same Xcode version that is Xcode 16 Beta 2. - some : Error Domain=com.apple.LocalAuthentication Code=-1000 "UI service connection invalidated." UserInfo={NSDebugDescription=UI service connection invalidated., NSLocalizedDescription=Authentication failure.}
1
0
77
1d
Xcode is running build tool plug-in that has been removed
I recently installed the Swift OpenAPI Generator on my Xcode project. I used it for a little bit but then decided that it would not work how I wanted it to, so I uninstalled it. I uninstalled all the packages related to the OpenAPI generator, and removed the generator from my projects build phases. However, when I try to build and run my project now, I get an error saying that my application could not find the OpenAPI generator script. I did delete this script, but I also removed it as a run build tool plug-in, so it should not be trying to execute in the first place. I used the instructions found in this WWDC23 video (at around the 9:00 minute mark). I am wondering how to completely remove this plug-in. I have tried searching my XCOde project, but I cannot find any indication of this plug-in still existing within my project. I have tried cleaning the build folder as well, but to no avail. What can I do to resolve this issue?
1
0
60
1d
Xcode quit Unexpectedly
whenever i run xcode i'm facing this error please help- Translated Report (Full Report Below) Process: Xcode [1652] Path: /Users/USER/Desktop/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 10.1 (14460.46) Build Info: IDEFrameworks_Fall2018-14460046000000000~5 (10B61) Code Type: X86-64 (Native) Parent Process: zsh [1646] Responsible: Terminal [1644] User ID: 501 Date/Time: 2024-07-04 16:40:54.0061 +0530 OS Version: macOS 12.7.5 (21H1222) Report Version: 12 Anonymous UUID: 43ECF59E-B6E9-40C9-FB05-BD0BC3DEECF1 Sleep/Wake UUID: DCFAF1AC-F53C-4271-8CF0-B11CAB4CAAB8 Time Awake Since Boot: 6000 seconds Time Since Wake: 157858150 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x00007ff81d3bf8f1 Exception Codes: 0x0000000000000002, 0x00007ff81d3bf8f1 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10 Terminating Process: exc handler [1652] VM Region Info: 0x7ff81d3bf8f1 is in 0x7ff81d200000-0x7ff81d400000; bytes after start: 1833201 bytes before end: 263950 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL __TEXT 7ff81c833000-7ff81d200000 [ 9.8M] r-x/r-x SM=COW ...ions/C/AppKit ---> __TEXT 7ff81d200000-7ff81d400000 [ 2048K] r-x/rwx SM=COW ...ions/C/AppKit __TEXT 7ff81d400000-7ff81d6c3000 [ 2828K] r-x/r-x SM=COW ...ions/C/AppKit Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libMainThreadChecker.dylib 0x1069aa069 swizzleImplementationFast + 115 1 libMainThreadChecker.dylib 0x1069a9ef0 addSwizzler + 165 2 libMainThreadChecker.dylib 0x1069a9ae6 __library_initializer + 2939 3 dyld 0x105d79e4f invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 182 4 dyld 0x105d66db3 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 129 5 dyld 0x105da0556 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 292 6 dyld 0x105d79d82 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144 7 dyld 0x105d79f0e dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 178 8 dyld 0x105d79fb2 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 108 9 dyld 0x105d88e00 dyld4::APIs::dlopen_from(char const*, int, void*) + 592 10 IDEFoundation 0x10460101e _IDEInitializeMainThreadChecker + 400 11 IDEFoundation 0x104601a59 IDEInitialize + 1021 12 IDEKit 0x107077e96 -[IDEApplicationController applicationWillFinishLaunching:] + 623 13 CoreFoundation 0x7ff819e2a66c CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 14 CoreFoundation 0x7ff819ec7a62 ___CFXRegistrationPost_block_invoke + 49 15 CoreFoundation 0x7ff819ec79e0 _CFXRegistrationPost + 496 16 CoreFoundation 0x7ff819dfc2d8 _CFXNotificationPost + 735 17 Foundation 0x7ff81ac3b59e -[NSNotificationCenter postNotificationName:object:userInfo:] + 82 18 DVTFoundation 0x1029a9c1d -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] + 361 19 AppKit 0x7ff81c862abe -[NSApplication finishLaunching] + 327 20 DVTKit 0x103062326 -[DVTApplication finishLaunching] + 294 21 AppKit 0x7ff81c8626c8 -[NSApplication run] + 250 22 AppKit 0x7ff81c83679a NSApplicationMain + 817 23 Xcode 0x101df682e main + 574 24 dyld 0x105d6a52e start + 462 Thread 1: 0 libsystem_pthread.dylib 0x7ff819d69f48 start_wqthread + 0 Thread 2: 0 libsystem_pthread.dylib 0x7ff819d69f48 start_wqthread + 0 Thread 3: 0 libsystem_pthread.dylib 0x7ff819d69f48 start_wqthread + 0 Thread 4: 0 libsystem_pthread.dylib 0x7ff819d69f48 start_wqthread + 0 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000100 rbx: 0x00007ff8341cb260 rcx: 0x00007ff837627608 rdx: 0x00007ff837427608 rdi: 0x00000001069aaefe rsi: 0x0000000000000100 rbp: 0x00007ff7be107870 rsp: 0x00007ff7be107850 r8: 0x0000000000000000 r9: 0x0000000000000830 r10: 0xb656bf33267d4fd1 r11: 0x61c886a9f021f049 r12: 0x0000000106980838 r13: 0x00007ff81d3bf8e1 r14: 0x0000000106980838 r15: 0x00007ff81d3bf8e1 rip: 0x00000001069aa069 rfl: 0x0000000000010202 cr2: 0x00007ff81d3bf8f1
0
0
41
1d
iOS18, interactive widget not respond (AppIntent not working)
here is my case: i add the AppIntent to both your app and widget extension targets. the intent will run my app process when app is running. it works perfectly on iOS 17. but iOS 18, my app process never called. i download app's demo, https://developer.apple.com/documentation/widgetkit/emoji-rangers-supporting-live-activities-interactivity-and-animations it looks like the same issue. it runs well because even it runs in the widget extension target, it still can present expected UI. but in real case, we need to run the app process to do some work. by debugging, i found the app process never called(set breakpoint). i add openAppWhenRun, it works well on iOS 18. but it will open the app when the widget is running. it is not what i want.
0
0
57
1d
How to debug over-release in Objective-C with ARC?
I'm getting a runtime assertion failure like this: "<FFRender3DView 0x616000271580> has reached dealloc but still has a super view. Super views strongly reference their children, so this is being over-released, or has been over-released in the past." Looking at the code, I can't see any strong reference to the view except by its superview, so I can't see how it could be released other than by removal from its superview. My first instinct was to override release and set a breakpoint there, but that's not possible in ARC code.
1
0
56
1d
Failed to install the app on the device
We currently try to run tests on 4 physically attached iPhones all on ios 17. When tests are concurrently running we occasionally get failures that look like this: Testing failed: Failed to install the app on the device. SwiftUITests-Runner encountered an error (Failed to install or launch the test runner. (Underlying Error: Failed to install the app on the device. (Underlying Error: Connection with the remote side was unexpectedly closed : { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => { length = 22, contents = "Connection interrupted" } }. Unhandled error domain IXRemoteErrorDomain, code 6)) I noticed that when relying on xcodebuild to install the target app and test runner it cannot install concurrently/parallel on all 4 devices but instead does each device sequentially causing the test to hang. The same behavior can be exhibited when trying to install an app concurrently on 4 different phones with xcrun devicectl as well. STEPS TO REPRODUCE Trigger a test with xcodebuild on 4 different phones at the same time where xcodebuild also needs to install the target apps. Currently using Xcode15.2 and iOS 17.5.1
1
0
54
1d
SampleTrips Previews work, but not in my primary project.
I wanted to get my SwiftData previews working in my primary project, so I started modeling them after the SampleTrips project. After messing around with that & being unable to make it work, I brought the same (working) sample code into my main project, unfortunately that's not working... I've attached the preview error (note, there's nothing in the Diagnostic Reports). //Sample code that works in it's own project, but not my primary target. import SwiftUI import SwiftData struct TestSwiftDataStuffView: View { let trip: Trip var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, \(trip.name)!") .padding() .foregroundColor(.red) } .padding() } } #Preview(traits: .sampleDataSecondary) { @Previewable @Query var trips: [Trip] TestSwiftDataStuffView(trip: trips.first!) } actor DataModelSecondary { struct TransactionAuthor { static let widget = "widget" } static let shared = DataModelSecondary() private init() {} nonisolated lazy var modelContainer: ModelContainer = { let modelContainer: ModelContainer let schema = Schema([ Trip.self ]) do { let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false, cloudKitDatabase: .none) modelContainer = try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Failed to create the model container: \(error)") } return modelContainer }() } @Model class Trip { @Attribute(.preserveValueOnDeletion) var name: String init(name: String) { self.name = name } } extension Trip { static var previewTrips: [Trip] { [ Trip(name: "Revenant"), Trip(name: "Newcastle"), Trip(name: "Bianca") ] } } struct SampleDataSecondary: PreviewModifier { static func makeSharedContext() throws -> ModelContainer { let config = ModelConfiguration(isStoredInMemoryOnly: true) let container = try ModelContainer( for: Trip.self, configurations: config ) SampleDataSecondary.createSampleData(into: container.mainContext) return container } func body(content: Content, context: ModelContainer) -> some View { content.modelContainer(context) } static func createSampleData(into modelContext: ModelContext) { Task { @MainActor in let sampleDataTrips: [Trip] = Trip.previewTrips let sampleData: [any PersistentModel] = sampleDataTrips //+ sampleDataLA + sampleDataBLT sampleData.forEach { modelContext.insert($0) } try? modelContext.save() } } } @available(iOS 18.0, *) extension PreviewTrait where T == Preview.ViewTraits { @MainActor static var sampleDataSecondary: Self = .modifier(SampleDataSecondary()) } Xcode16Preview.txt
2
0
145
1d
Xcode build crashes on: No such module '_SwiftData_SwiftUI'
Building with below imports returns an error. What could I do to mitigate this? I did clean the build cache and delete the derived data folder. import SwiftData import SwiftUI The error: Command SwiftCompile failed with a nonzero exit code /Users/thomas/Documents/Projects/SwiftUI/workouts/Workouts/Workouts/Views/Workout/WorkoutView.swift:9:8 No such module '_SwiftData_SwiftUI' This feedback has also been submitted under: FB14182548
2
1
47
1d
CreateML Object Tracking doesn't enable Train button
I tried to train on some of my USDZs. For some the CreateML viewport shows the object's dimensions and enables the Train button. Many others, including the official USDZ for the iPhone 15Pro (iphone_15_pro_blue_titanium_5G.usdz) do not show the dimensions and keep [Train] disabled. What do I have to author inside the USDZ to make it work? There are no lights or cameras in the asset file, as recommended in the release notes. Also no animations.
2
0
71
2d
Issue with Core Simulator Cache Consuming Disk Space
I recently ran out of disk space and discovered that my System Data was consuming 866 GB of storage. After investigating, I found multiple directories named "Dead" nested within my developer data, consuming nearly 600 GB of storage. An example path is: /Users//Library/Developer/CoreSimulator/Devices//data/Library/Caches/com.apple.containermanagerd/Dead These directories contained multiple directories titled "temp.". Rebooting the computer did not empty these "Dead" directories; I had to manually delete them. What is the expected lifespan of the temporary directories stored in the "Dead" directory?
1
0
61
2d
Xcode bundles all of swift-collection's products even though only one is selected
I've added swift-collections to a project and I only selected OrderedCollections to be added to my target. Coincidentally, I was investigating the size of my apps binary (built and archived with Xcode for App Store Connect) with bloaty and I saw that every package product of swift-collections was somehow linked to the binary (HeapModule, RopeModule, ...). This was the command: bloaty -d compileunits --debug-file=Path_to_dsym_file.dSYM/Contents/Resources/DWARF/{YOUR_APP_NAME} path_to_your_app_binary -n 0 After that I tried importing one of these packages, which just worked, even though as mentioned I did not select them when adding the package. Is this a limitation/bug/feature of Swift Package Manager, or even Xcode? Is this to be expected? I am using Xcode 15.4.
0
0
72
2d
IAP restoration confirmation
When IAP is purchased the following is correctly displayed. “You’re all set Your purchase was successful.” However, when a previous IAP is restored, purchase will be restored but there is no feedback/notification displayed. Therefore, after an IAP is successfully restored, the following feedback/notification would be very helpful (similar to when the app is purchased): “You’re all set Your purchase has been successfully restored” I understand this is not related to coding by the developer but has to do with the apples in-app purchase process.
0
0
18
2d