In my app, I worked with ios18 by default and I had no issue, everything was working fine. However, when I wanted to test it with an iOS 17.5 simulator or real device, it is unusable because it crash when object with a relationship are created.
on the first line you can see my relationship, and under it it is the extended relationship macro unmodifiable.
has someone already encountered this? any clue of a hide modification of relationship working behavior in ios18?
this is really annoying cause it make me unable to reduce the minimum deployment target of my app to ios17
Post
Replies
Boosts
Views
Activity
I struggle because im using a beta version of macOS, making me unable to export my Xcode build to App Store Connect. so I wanted to downgrade my silicon MacBook to Sonoma, in order to install the latest not beta version of Xcode. but I really struggle: I want to use an empty external ssd disk but when following the doc I face the following issue:
if I perfectly follow this https://support.apple.com/en-us/101578
when I try to boot in recovery by selecting the Sonoma installer, my external disk is gray showing the error "This volume is not formatted as APFS".
sorry for low quality
then if I try to fix this, by going to Disk Utility, finding my external disk and format it to APFS (instead of Mac OS Extended (Journaled) like in the doc), when I try to run the command of the doc I get:
leandrotolaini@Leandros-MacBook-Pro ~ % sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled
Password:
Ready to start.
To continue we need to erase the volume at /Volumes/Untitled.
If you wish to continue type (Y) then press return: y
APFS disks may not be used as bootable install media.
An error occurred erasing the disk.
this occurs when I change format to APFS here
I don't know what to do...
I get this error :
ModelContainer creation failed: SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer, _explanation: nil)
AbsGod/AbsGodApp.swift:25: Fatal error: Failed to create ModelContainer: The operation couldn’t be completed. (SwiftData.SwiftDataError error 1.)
when doing:
struct MyAppApp: App {
let container: ModelContainer
init() {
do {
let schema = Schema([
Workout.self,
Exercise.self
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
container = try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
print("ModelContainer creation failed: \(error)")
fatalError("Failed to create ModelContainer: \(error.localizedDescription)")
}
}
var body: some Scene {
WindowGroup {
TabBarView()
.tint(.red)
}
.modelContainer(for: [Workout.self, Exercise.self])
}
And I have no clue of how to resolve that. I saw similar issues with CloudKit, but I don't even have enabled it, just ticked Automatically manage signing in Signing & Capabilities of my project.
the relationship of my classes are defined like this, in a workout class having an array of exercises:
@Relationship(deleteRule: .cascade, inverse: \Exercise.workout) var exercises: [Exercise]? = []
and the inverse in the exercise class:
var workout: Workout?
I don't feel like the problem is coming from my classes, because when I try to reproduce the error on simpler project, everything works. it just won't create a modelContainder in my project and I have no idea what can makes that and the error is not really explicit...
When I try to delete items from my list stored with swift data, it instantly makes crash my app with this error message: SwiftData/BackingData.swift:482: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-coredata://03DEFFA9-87EF-4E13-9448-946D9EBC17B6/Exercise/p8), implementation: SwiftData.PersistentIdentifierImplementation) with Optional(0252D555-649A-45B2-954C-7DD62A6DBAE4)
import SwiftUI
import SwiftData
struct WorkoutsView: View {
@Environment(\.modelContext) var modelContext
@Query(sort: [
SortDescriptor(\Workout.name),
SortDescriptor(\Workout.difficulty),
SortDescriptor(\Workout.duration)
]) var workouts: [Workout]
@State private var isEditing = false
@State private var showingAddScreen = false
var body: some View {
NavigationStack {
List {
ForEach(workouts) { workout in
//design purpose code
}
.onDelete(perform: deleteWorkouts)
}
.navigationTitle("Workouts")
.toolbar {
ToolbarItem(placement: .topBarLeading) {
EditButton()
}
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
showingAddScreen = true
}) {
Image(systemName: "plus")
}
}
}
.sheet(isPresented: $showingAddScreen) {
AddWorkoutView()
}
}
}
func deleteWorkouts(at offsets: IndexSet) {
for offset in offsets {
let workout = workouts[offset]
modelContext.delete(workout)
}
}
}