I'm using SwiftData with an @Model and am also using an @ModelActor. I've fixed all concurrency issues and have migrated to Swift 6. I am getting a console error that I do not understand how to clear. I get this error in Swift 6 and Swift 5. I do not experience any issue with the app. It seems to be working well. But I want to try to get all issues taken care of. I am using the latest Xcode beta.
error: the replacement path doesn't exist:
"/var/folders/1q/6jw9d6mn0gx1znh1n19z2v9r0000gp/T/swift-generated-sources/@_swiftmacro_17MyAppName14MyModelC4type18_PersistedPr> opertyfMa.swift"
Post
Replies
Boosts
Views
Activity
modelContext.fetchIdentifiers(descriptor) errors when using a SortDescriptor to sort by a variable and returns no models. The fetch works fine without a SortDescriptor, thus
FetchDescriptor<MyModel>()
works fine, but
FetchDescriptor<MyModel>(sortBy: [.init(\.title)])
or
FetchDescriptor<MyModel>(sortBy: [SortDescriptor(\.title)])
errors with console message
The operation couldn’t be completed. (SwiftData.SwiftDataError error 1.)
I am using Xcode Version 16.0 beta 6 (16A5230g).
I took one of my apps and have gone through the process of making it compatible with Swift 6. I started with Swift 5 and Complete Concurrency Checking and eliminated every warning. I flipped the switch to Swift 6 and I have no compile errors and no warnings. I also created a ModelActor and created async functions to fetch, delete, get an object's persistentID and save model objects. My SwiftData model has a notes property and the user can update or add onto the notes and resave the model object. The app crashes when I save the changes using an explicit save operation. However, the next time the app is launched, the changes did propagate. If I do not use the explicit save operation, the system does not auto-save and does not crash.
When I switched back to Swift 5 and tried it out, I was able to save without a crash. I did need to use an explicit save operation though.
However, I am now getting 3 warnings like the following.
Type 'ReferenceWritableKeyPath<MyModel, Optional>' does not conform to the 'Sendable' protocol; this is an error in the Swift 6 language mode
The line of code that produced that warning is
`let fetchDescriptor = FetchDescriptor(sortBy: [SortDescriptor(\MyModel.title)])
However, when I flip the switch back to Swift 6, the three warnings go away and I have zero warnings under Swift 6.
I'm getting a lot of warnings of this within my app. I'm trying to migrate to Swift 6.
I'm going through the migration to Swift 6 and I am running up with a few things. I have two view controllers which conform to the CLLocationManagerDelegate protocol. Both methods of the delegate have the same issue in my code. Below is an example of the warning received.
Main actor-isolated instance method 'locationManagerDidChangeAuthorization' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode
I am curious about the fact that the Text above the VStack is shown as a title to the view. I didn't know one could place Text above a VStack without another VStack. Here's the partial code showing the situation.
@State private var results = [Result]()
var body: some View {
Text("Songs of Al Di Meola on iTunes")
.font(.title3)
.fontWeight(.bold)
List(results, id: \.trackId) { item in
VStack(alignment: .leading) {
Text(item.trackName)
.font(.headline)
Text(item.collectionName)
}
}
.task {
await loadData()
}
}
See picture for details.
CKRecord is a class which does not conform to the Sendable protocol. Its fields consist of NSStrings, NSData and others which are not Sendable. I understand that Apple is incrementally modifying objects to be sendable, but I am experiencing and I would assume others are experiencing a very large number of warnings (for now) about CKRecords and Sendable.
It may be too much to make CKRecord Sendable and it may be too much to create a Sendable version of CKRecord, but it would be nice if it could at least be investigated.
My particular situation is I have created a Protocol named CKMethods which some of my view controllers use to download and upload CKRecords. I suddenly have a large number of warnings about non-sendable types being sent from main actor-isolated context to non-isolated instance method. The CKRecords sent to and from the protocol do not get mutated and I have never had a problem with data races in the years that I have had this protocol. At some point, the warnings will probably become errors and I definitely do not want to get to that point.
I am still coming up to speed on Swift Concurrency, so there may be a more simple solution than the one I am working on - creating a Sendable Struct for every CKRecord type that I have in my app and modifying all of the methods to pass the Struct instead of a CKRecord and convert the Struct to a CKRecord for upload and convert the CKRecord to the Struct for download.
Question. Is there a way to hook up the Apple Vision Pro to the Mac for development without using the $299 dongle? I was thinking of a USB-C cable from the battery to the Mac. Someone mentioned wireless, but usually one has to connect first.
I get the following message when I try to run this app in Xcode.
Could not launch AppName. Runningboard has returned error 5. Please check the system logs for the underlying cause of the error.
Interestingly, the destination Mac (Mac Catalyst) destination does launch. The funny thing is there is a companion app almost exactly like this one that launches fine. Any help with this would be greatly appreciated.
Xcode helped me to file a feedback. The number is FB13206919.
I've been working on a visionOS platform for my existing app. I added the visionOS platform in App Store Connect. In Xcode 15.2, I set the destination to 'Any visionOS Device (Designed for iPad, arm64)'. The App Store Connect visionOS platform does not see the build. It does show up as an iOS build on Test Flight. I don't see anyway to designate the build as a build that the visionOS destination sees. Also, the upload failed when I tried to set the version for the app as 1.0. It went through when I put the version as a number higher than my iOS app version.
I have had this issue for many many months and decided to reach out here to see if anybody else has had and fixed this problem. I can compete the purchase on the Mac. I can make a full price purchase using the Apple Card on the Apple Store App.
Is there anyway to do the following basic outline with the exception of a modal presentation? It seems like there should be some additional input that designates a modal transition. But I cannot find one.
NavigaitonStack
NavigationLink
.navigationDestination
I have modified two of my apps to run on visionOS and I see that in App Store Connect, one add a visionOS Platform. My question is, why would I want to do this if I can't upload a visionOS binary? Would it be to work on the metadata? Also, I would like to have my visionOS binary evaluated. Is there any way to do this at this time? It appears that only iOS or iPadOS apps are being evaluated.
If I do this, I'll only have to submit the iOS version of the app and not have to dork with two app reviews. What do you think? What am I missing?
I can use the option key to bring up the two dots and I can add the shift key to move around the dots, but when I untouch the shift key, one dot moves across the map instead of the dots staying together. Is this even a feature that should work on the visionOS simulator?