Post

Replies

Boosts

Views

Activity

Reply to Stream response
I had a programming error. The PartiallyGenerated responses are sequentially improving versions of the final response. Initially I thought they were sequential responses to be combined together as the final response. With proper programming, the stream responses are as good as results of respond method.
Jul ’25
Reply to DispatchSemaphore freeze
The alignmentGuide modifier is @preconcurrency nonisolated. In Swift 6, I had to call a nonisolated function to calculate alignment, in which a certain @MainActor property was needed. That's why I tried to use a semaphore. I have switched back to Swift 5, since AVFoundation is not ready for Swift 6. The problem here is solved by removing nonisolated and semaphore. We may handle it after switching to Swift 6 in the future. Thanks.
Oct ’24
Reply to Sending '$0' risks causing data races
In class SystemPreferredCameraObserver of sample code AVCam: Building a camera app, the following let newDevice = change?[.newKey] as? AVCaptureDevice continuation?.yield(newDevice) causes error in Xcode 16.1 RC: Sending 'newDevice' risks causing data races Task-isolated 'newDevice' is passed as a 'sending' parameter; Uses in callee may race with later task-isolated uses What might be a workaround here?
Topic: Media Technologies SubTopic: Video Tags:
Oct ’24
Reply to SwiftData does not work on a background Task even inside a custom ModelActor.
I try to save data off the main actor with the following actor @ModelActor final actor DataActor { init(container: ModelContainer) { let context = ModelContext(container) context.autosaveEnabled = true modelContainer = container modelExecutor = DefaultSerialModelExecutor(modelContext: context) } } and fetch data with the main context, but no data are fetched. Data might not be saved by the above actor. After switching to data saving with the main context, it works.
Aug ’23
Reply to NSUnknownKeyException: not key value coding-compliant for the key "(null)"
Xcode 15 beta 6 reports a new error for the array property: CoreData: fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable. CoreData: warning: Property 'dataSets' on Entity 'Station' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.
Aug ’23
Reply to Context outside of SwiftUI Views
The documentation for ModelContext says it's Sendable, but when I use the context of the ModelActor above in another actor, I get a warning in Xcode 15 beta 4: Non-sendable type 'ModelContext' in implicitly asynchronous access to actor-isolated property 'context' cannot cross actor boundary Calling the run method causes a similar warning. What's happening?
Jul ’23
Reply to Symbol not found
Forgot to update iPadOS. Solved.
Replies
Boosts
Views
Activity
Jul ’25
Reply to Foundation Model Always modelNotReady
With iPadOS 26 beta 3, when the system language is English, the model is quickly downloaded. When the system language is set to another Apple Intelligence supported language, the model is never downloaded, even after calling session.prewarm().
Replies
Boosts
Views
Activity
Jul ’25
Reply to Stream response
I had a programming error. The PartiallyGenerated responses are sequentially improving versions of the final response. Initially I thought they were sequential responses to be combined together as the final response. With proper programming, the stream responses are as good as results of respond method.
Replies
Boosts
Views
Activity
Jul ’25
Reply to DispatchSemaphore freeze
The alignmentGuide modifier is @preconcurrency nonisolated. In Swift 6, I had to call a nonisolated function to calculate alignment, in which a certain @MainActor property was needed. That's why I tried to use a semaphore. I have switched back to Swift 5, since AVFoundation is not ready for Swift 6. The problem here is solved by removing nonisolated and semaphore. We may handle it after switching to Swift 6 in the future. Thanks.
Replies
Boosts
Views
Activity
Oct ’24
Reply to Sending '$0' risks causing data races
In class SystemPreferredCameraObserver of sample code AVCam: Building a camera app, the following let newDevice = change?[.newKey] as? AVCaptureDevice continuation?.yield(newDevice) causes error in Xcode 16.1 RC: Sending 'newDevice' risks causing data races Task-isolated 'newDevice' is passed as a 'sending' parameter; Uses in callee may race with later task-isolated uses What might be a workaround here?
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to SwiftData CloudKit integration seems to log out or deregister
I have a similar problem. My app saves data in SwiftData on an iPhone, and to a CloudKit private container. Works well for the iPhone. However, when running the app on an iPad signed in the same iCloud account, data are not fetched from CloudKit.
Replies
Boosts
Views
Activity
Dec ’23
Reply to SwiftData does not work on a background Task even inside a custom ModelActor.
I try to save data off the main actor with the following actor @ModelActor final actor DataActor { init(container: ModelContainer) { let context = ModelContext(container) context.autosaveEnabled = true modelContainer = container modelExecutor = DefaultSerialModelExecutor(modelContext: context) } } and fetch data with the main context, but no data are fetched. Data might not be saved by the above actor. After switching to data saving with the main context, it works.
Replies
Boosts
Views
Activity
Aug ’23
Reply to Context outside of SwiftUI Views
With iOS 17 beta 6, Xcode 15 beta 6, my app crashes with: dyld[600]: Symbol not found: _$s9SwiftData20DefaultModelExecutorC7contextAcA0D7ContextC_tcfC No such problem with iOS 17 beta 5.
Replies
Boosts
Views
Activity
Aug ’23
Reply to NSUnknownKeyException: not key value coding-compliant for the key "(null)"
Xcode 15 beta 6 reports a new error for the array property: CoreData: fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable. CoreData: warning: Property 'dataSets' on Entity 'Station' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.
Replies
Boosts
Views
Activity
Aug ’23
Reply to Context outside of SwiftUI Views
The documentation for ModelContext says it's Sendable, but when I use the context of the ModelActor above in another actor, I get a warning in Xcode 15 beta 4: Non-sendable type 'ModelContext' in implicitly asynchronous access to actor-isolated property 'context' cannot cross actor boundary Calling the run method causes a similar warning. What's happening?
Replies
Boosts
Views
Activity
Jul ’23
Reply to SwiftData framework crashes application when enumerations are part of arrays
Array property in SwiftData model seems to cause hang in my app, and the following errors: fault: Either a non nil result OR an error CoreData: Either a non nil result OR an error fault: Either a non nil result OR an error OR an exception CoreData: Either a non nil result OR an error OR an exception Foundation._GenericObjCError.nilError
Replies
Boosts
Views
Activity
Jul ’23
Reply to SwiftData and correct setup for AppGroup
To share data between iOS/watchOS app and extension, @AppStorage fetches data automatically. With SwiftData, if outside SwiftUI View, the programmer needs to create a fetch descriptor and fetch data manually. Is SwiftData really better than @AppStorage in ObsersableObject?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to English to English translation?
After killing the app on iPhone, and launch it on iPhone, all strings are displayed correctly. However, launching it again in Xcode, all strings are capital again. It's a bug🐞
Replies
Boosts
Views
Activity
Jul ’23
Reply to Mark localized strings untranslatable
In the string catalog, links from keys to places where they are extracted would be helpful. I have keys like %@ and %1$@ %2$@ that I'd like to mark verbatim, but don't know where the sources are.
Replies
Boosts
Views
Activity
Jul ’23
Reply to @Observable and @AppStorage
With @Observable or SwiftData model, how to share data between iOS app and widgets, if @AppStorage is unavailable?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23