Post

Replies

Boosts

Views

Activity

Reply to Orphaning a CKAsset
can you show some code? I put together a barebones demo that goes through the same flow, with many shortcuts for brevity sake. When I need to delete an ImageReference instance, I call the DataManager's deleteImage(_) method. When I do so, it falls through to the failure case of the CloudKitController's pushToICloud method. // CloudObject import Foundation import CloudKit class CloudObject: NSObject { var properties: [String] = [] var className: String = "" let cloudIdentifier = UUID().uuidString func cloudRecord() -> CKRecord { let recordID = CKRecord.ID(recordName: cloudIdentifier) let record = CKRecord(recordType: className, recordID: recordID) for property in properties { let value = self.value(forKey: property) record.setValue(value, forKey: property) } addAssetsToRecord(record) return record } func addAssetsToRecord(_ record: CKRecord) { // let subclasses use for adding assets or other content as needed } } // ImageReference import Foundation import CloudKit import UniformTypeIdentifiers class ImageReference: CloudObject { @objc var largeImage: Data? @objc var thumbnailImage: Data? private var largeImageURL: URL { return ImageReference.imageFolderURL.appendingPathComponent(cloudIdentifier + "-large.jpg", conformingTo: .image) } private var thumbnailURL: URL { return ImageReference.imageFolderURL.appendingPathComponent(cloudIdentifier + "-thumbnail.jpg", conformingTo: .image) } static let imageFolderURL: URL = URL.documentsDirectory.appendingPathComponent("Images", conformingTo: .folder) override init() { super.init() className = "ImageReference" properties.append(contentsOf: ["largeImage", "thumbnailImage"]) } override func addAssetsToRecord(_ record: CKRecord) { // add the image data as CKAssets let largeAsset = CKAsset(fileURL: largeImageURL) let thumbAsset = CKAsset(fileURL: thumbnailURL) record.setObject(largeAsset, forKey: "largeImage") record.setObject(thumbAsset, forKey: "thumbnailImage") } } // DataManager import Foundation class DataManager { var cloudKitController = CloudKitController() func deleteImage(_ imageRef: ImageReference) async { // delete the image reference from the local database... // then: imageRef.largeImage = nil imageRef.thumbnailImage = nil await cloudKitController.pushToICloud(object: imageRef) } } // CloudKitController import Foundation import CloudKit import os.log class CloudKitController { private var ckDatabase: CKDatabase init() { let container = CKContainer(identifier: "Demo Container Name") ckDatabase = container.privateCloudDatabase } func pushToICloud(object: CloudObject) async { // get a CKRecord for the object let record = object.cloudRecord() do { let response = try await ckDatabase.modifyRecords(saving: [record], deleting: [], atomically: false) let resultsDict = response.saveResults for result in resultsDict { switch result.value { case .success(let record): // call code that handles writing record to local DB break // switch requires code execution of some sort, so for this demo... case .failure(let error): if let ckError = (error as? CKError) { os_log("CK - CloudKit failure with error: \(ckError) in \(#function)") } } } } catch { //handle the error } } }```
2w
Reply to Exception unarchiving UIToolbar in iOS 18.5 simulator with Xcode 26 beta 2
Like javierCantoAltomobile, I am also seeing this on device. In my case it's on an iPad running iOS 18.5. Here’s what’s logged in the Xcode 26 beta 3 console while trying to run the project (and then printing the Exception): Toolbar-Exception(907,0x1fa87db40) malloc: xxm: failed to initialize deferred reclamation buffer [2] (null) Printing description of exception->exception: Could not instantiate class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ because no class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target) (null) I sure hope this is fixed soon. It's a show-stopper for me on an important project. Once again, the Feedback number is FB18587743.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to URL in scene openURLContexts does not exist
Thanks for pointing out my error. Unfortunately I'm still getting the same results with the correct separator: (lldb) po FileManager.default.fileExists(atPath: "/private/var/mobile/Library/Mobile Documents/") true (lldb) po FileManager.default.fileExists(atPath: "/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs") false (lldb) po FileManager.default.fileExists(atPath: url.path) false To try to determine that this wasn't just a LLDB issue, I updated my code slightly: func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { guard let url = URLContexts.first?.url else { os_log("URL in %@ is nil", #function) return } let fileExists = FileManager.default.fileExists(atPath: url.path) fileExists is false after AirDropping a file. And of course this is happening within the method where openURLContexts is passed as an argument, and therefore the URL should be valid. So I'm still stuck at the same place.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to Can't install any apps on my new iPhone 16 Pro with iOS 18 from XCode
I was running into the same error with my newly acquired iPhone 16 Pro. I downloaded Xcode 16.1 beta 2 as suggested in this thread and successfully set it up for development. This morning my phone was updated to what appears to be the final iOS 18 version (as opposed to the version installed on new phones) and tried Xcode 16 (NON beta) again. This time the setup for development worked immediately. That suggests to me that Xcode 16 came with a package specifically for the final version of iOS 18, and not for the version shipped on new phones. Hopefully this will all be resolved soon between shipping phones with the latest OS version and updates to Xcode. FWIW, I updated my phone manually in Settings>General>Software Update.
Sep ’24
Reply to Xcode previews fail with JIT error
I just updated to Xcode 16 beta 3. A very simple Mac app I developed in beta 2 that previewed successfully just prior to the Xcode upgrade has started crashing on preview with the "fatalError in UVJITAgent.swift" message. It builds and runs successfully. It's only a problem previewing the app's one view.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to Why doesn't the Apple Vision Pro simulator appear as a run destination?
I'm experiencing the same problem. I just installed the visionOS 1 beta 4 via the Terminal (using the "xcrun simctl runtime add " command). That resulted in the visionOS 1.0 Simulator appearing in the list of available platforms in Xcode 15's Settings window. But when I try to add a new target to an existing project, or even create a new project, there is no visionOS option in the template chooser that appears. I have quit and relaunched Xcode a few times, but that has not helped. Is there something else I need to be doing?
Oct ’23
Reply to Apple Silicon app builds but cannot launch
I am running into the same problem with running an iPad app on my M1 MBP. I am seeing the same error message in both Xcode 13.x and Xcode 14 beta 3. I have tried deleting the built product and rerunning the project. I have tried switching from automatic codesigning to manually codesigning the project. I have tried changing the bundle identifier with both automatic and manual codesigning. I have even tried running it after removing the one library it uses (a Swift package). None of these actions has resolved the problem. This is very frustrating because I know the project ran as a Mac app successfully last time I tried a month ago. Has anybody come up with any further solutions to this problem that haven't yet been mentioned in this thread?
Jul ’22
Reply to Combine in AppKit - issue with publisher(for: NSControl.textDidChangeNotification...
I finally realized that I simply needed to keep a strong reference to sub. The finished code now looks something like:     private var searchTextObserver: AnyCancellable!     private var item: ModelItem!     private func setupTextObserver() {       let sub = NotificationCenter.default         .publisher(for: NSControl.textDidChangeNotification, object: searchTermText)         .map( { ($0.object as! NSTextField).stringValue } )         .debounce(for: .milliseconds(500), scheduler: RunLoop.main)         .sink(receiveValue: { [weak self] in             self?.item.value = $0         })         searchTextObserver = sub     }
Topic: UI Frameworks SubTopic: AppKit Tags:
Apr ’21
Reply to Orphaning a CKAsset
Make this function handle nil values for largeImageURL and thumbnailURL… Yes! That was the problem. Thanks for spotting that for me. I actually need to check for nil Data (not URL) properties, but that fixed the problem.
Replies
Boosts
Views
Activity
2w
Reply to Orphaning a CKAsset
can you show some code? I put together a barebones demo that goes through the same flow, with many shortcuts for brevity sake. When I need to delete an ImageReference instance, I call the DataManager's deleteImage(_) method. When I do so, it falls through to the failure case of the CloudKitController's pushToICloud method. // CloudObject import Foundation import CloudKit class CloudObject: NSObject { var properties: [String] = [] var className: String = "" let cloudIdentifier = UUID().uuidString func cloudRecord() -> CKRecord { let recordID = CKRecord.ID(recordName: cloudIdentifier) let record = CKRecord(recordType: className, recordID: recordID) for property in properties { let value = self.value(forKey: property) record.setValue(value, forKey: property) } addAssetsToRecord(record) return record } func addAssetsToRecord(_ record: CKRecord) { // let subclasses use for adding assets or other content as needed } } // ImageReference import Foundation import CloudKit import UniformTypeIdentifiers class ImageReference: CloudObject { @objc var largeImage: Data? @objc var thumbnailImage: Data? private var largeImageURL: URL { return ImageReference.imageFolderURL.appendingPathComponent(cloudIdentifier + "-large.jpg", conformingTo: .image) } private var thumbnailURL: URL { return ImageReference.imageFolderURL.appendingPathComponent(cloudIdentifier + "-thumbnail.jpg", conformingTo: .image) } static let imageFolderURL: URL = URL.documentsDirectory.appendingPathComponent("Images", conformingTo: .folder) override init() { super.init() className = "ImageReference" properties.append(contentsOf: ["largeImage", "thumbnailImage"]) } override func addAssetsToRecord(_ record: CKRecord) { // add the image data as CKAssets let largeAsset = CKAsset(fileURL: largeImageURL) let thumbAsset = CKAsset(fileURL: thumbnailURL) record.setObject(largeAsset, forKey: "largeImage") record.setObject(thumbAsset, forKey: "thumbnailImage") } } // DataManager import Foundation class DataManager { var cloudKitController = CloudKitController() func deleteImage(_ imageRef: ImageReference) async { // delete the image reference from the local database... // then: imageRef.largeImage = nil imageRef.thumbnailImage = nil await cloudKitController.pushToICloud(object: imageRef) } } // CloudKitController import Foundation import CloudKit import os.log class CloudKitController { private var ckDatabase: CKDatabase init() { let container = CKContainer(identifier: "Demo Container Name") ckDatabase = container.privateCloudDatabase } func pushToICloud(object: CloudObject) async { // get a CKRecord for the object let record = object.cloudRecord() do { let response = try await ckDatabase.modifyRecords(saving: [record], deleting: [], atomically: false) let resultsDict = response.saveResults for result in resultsDict { switch result.value { case .success(let record): // call code that handles writing record to local DB break // switch requires code execution of some sort, so for this demo... case .failure(let error): if let ckError = (error as? CKError) { os_log("CK - CloudKit failure with error: \(ckError) in \(#function)") } } } } catch { //handle the error } } }```
Replies
Boosts
Views
Activity
2w
Reply to Exception unarchiving UIToolbar in iOS 18.5 simulator with Xcode 26 beta 2
Like javierCantoAltomobile, I am also seeing this on device. In my case it's on an iPad running iOS 18.5. Here’s what’s logged in the Xcode 26 beta 3 console while trying to run the project (and then printing the Exception): Toolbar-Exception(907,0x1fa87db40) malloc: xxm: failed to initialize deferred reclamation buffer [2] (null) Printing description of exception->exception: Could not instantiate class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ because no class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target) (null) I sure hope this is fixed soon. It's a show-stopper for me on an important project. Once again, the Feedback number is FB18587743.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to URL in scene openURLContexts does not exist
Thanks for pointing out my error. Unfortunately I'm still getting the same results with the correct separator: (lldb) po FileManager.default.fileExists(atPath: "/private/var/mobile/Library/Mobile Documents/") true (lldb) po FileManager.default.fileExists(atPath: "/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs") false (lldb) po FileManager.default.fileExists(atPath: url.path) false To try to determine that this wasn't just a LLDB issue, I updated my code slightly: func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { guard let url = URLContexts.first?.url else { os_log("URL in %@ is nil", #function) return } let fileExists = FileManager.default.fileExists(atPath: url.path) fileExists is false after AirDropping a file. And of course this is happening within the method where openURLContexts is passed as an argument, and therefore the URL should be valid. So I'm still stuck at the same place.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to Exception unarchiving UIToolbar in iOS 18.5 simulator with Xcode 26 beta 2
Now that I've tried my full project on my iPad, I can see that it's happening there as well. It continues to run just fine from Xcode 16.4. I updated the feedback with the Console message from Xcode 26.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to Exception unarchiving UIToolbar in iOS 18.5 simulator with Xcode 26 beta 2
FB18587743 (Slightly misleadingly titled as a crash.)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to Creating "type-safe" CIFilter fails
Importing CoreImage.CIFilterBuiltins fixed the problem for me. Thanks much.
Replies
Boosts
Views
Activity
Nov ’24
Reply to Can't install any apps on my new iPhone 16 Pro with iOS 18 from XCode
I was running into the same error with my newly acquired iPhone 16 Pro. I downloaded Xcode 16.1 beta 2 as suggested in this thread and successfully set it up for development. This morning my phone was updated to what appears to be the final iOS 18 version (as opposed to the version installed on new phones) and tried Xcode 16 (NON beta) again. This time the setup for development worked immediately. That suggests to me that Xcode 16 came with a package specifically for the final version of iOS 18, and not for the version shipped on new phones. Hopefully this will all be resolved soon between shipping phones with the latest OS version and updates to Xcode. FWIW, I updated my phone manually in Settings>General>Software Update.
Replies
Boosts
Views
Activity
Sep ’24
Reply to Xcode previews fail with JIT error
I just updated to Xcode 16 beta 3. A very simple Mac app I developed in beta 2 that previewed successfully just prior to the Xcode upgrade has started crashing on preview with the "fatalError in UVJITAgent.swift" message. It builds and runs successfully. It's only a problem previewing the app's one view.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Why doesn't the Apple Vision Pro simulator appear as a run destination?
I'm experiencing the same problem. I just installed the visionOS 1 beta 4 via the Terminal (using the "xcrun simctl runtime add " command). That resulted in the visionOS 1.0 Simulator appearing in the list of available platforms in Xcode 15's Settings window. But when I try to add a new target to an existing project, or even create a new project, there is no visionOS option in the template chooser that appears. I have quit and relaunched Xcode a few times, but that has not helped. Is there something else I need to be doing?
Replies
Boosts
Views
Activity
Oct ’23
Reply to Apple Silicon app builds but cannot launch
I am running into the same problem with running an iPad app on my M1 MBP. I am seeing the same error message in both Xcode 13.x and Xcode 14 beta 3. I have tried deleting the built product and rerunning the project. I have tried switching from automatic codesigning to manually codesigning the project. I have tried changing the bundle identifier with both automatic and manual codesigning. I have even tried running it after removing the one library it uses (a Swift package). None of these actions has resolved the problem. This is very frustrating because I know the project ran as a Mac app successfully last time I tried a month ago. Has anybody come up with any further solutions to this problem that haven't yet been mentioned in this thread?
Replies
Boosts
Views
Activity
Jul ’22
Reply to Have you ever seen this debugger message?
I've been seeing this message frequently today while checking out an Apple sample app running in iOS 12.4 iPad simulators. The only way I found to resolve it was to quit the simulator app and run the project from Xcode again.
Replies
Boosts
Views
Activity
Jun ’22
Reply to Combine in AppKit - issue with publisher(for: NSControl.textDidChangeNotification...
I finally realized that I simply needed to keep a strong reference to sub. The finished code now looks something like:     private var searchTextObserver: AnyCancellable!     private var item: ModelItem!     private func setupTextObserver() {       let sub = NotificationCenter.default         .publisher(for: NSControl.textDidChangeNotification, object: searchTermText)         .map( { ($0.object as! NSTextField).stringValue } )         .debounce(for: .milliseconds(500), scheduler: RunLoop.main)         .sink(receiveValue: { [weak self] in             self?.item.value = $0         })         searchTextObserver = sub     }
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Apr ’21