Updated the phone to iOS 26.1 and now the app is not working anymore, even previously approved version published on App Store which works perfectly on iOS 26.0.1, and iOS 18+.
I deleted the app from the phone and installed fresh from App Store, still the same.
Logic is that on start app copies previously prepared SwiftData store file (using the same models) from app bundle to Documents directory and uses it.
Currently app just hungs with loader spinner spinning as it can t connect to the store.
Getting this error in console when running from Xcode on real device with iOS 26.1 installed:
CoreData: error:
CoreData: error: Store failed to load. <NSPersistentStoreDescription: 0x10c599e90> (type: SQLite, url: file:///var/mobile/Containers/Data/Application/DA32188D-8887-48F7-B828-1F676C8FBEF8/Documents/default.store)
with error = Error Domain=NSCocoaErrorDomain Code=134140
"Persistent store migration failed, missing mapping model."
UserInfo={sourceModel=(<NSManagedObjectModel: 0x10c503ac0>) isEditable 0,
entities { /// there goes some long models description
addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134140)
Any help or workaround will be greatly appreciated.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have one target building and filling the SwiftData store and then copying the same store file to another target of the app to use the contents.
That worked fine from iOS 17 to iOS 26.0.1
Under iOS 26.1 I am getting following error:
CoreData: error:
This store file was previously used on a build with Persistence-1522 but is now running on a build with Persistence-1518.
file:///Users/xxx/Library/Developer/CoreSimulator/Devices/0FE92EA2-57FA-4A5E-ABD0-DAB4DABC3E02/data/Containers/Data/Application/B44D3256-9B09-4A60-94E2-C5F11A6519E7/Documents/default.store
What does it mean and how to get back to working app under iOS 26.1?
I wanted to set navigationTitle value to space symbol on my iOS app (Swift 6, iOS 26.0) (so that navigationBar opens in large mode initially before the actual value is being fetched).
In my view I used this:
.navigationTitle(" ")
And on device I got unexpectedly two quote symbols:
Not sure if there is space in between, and the symbols look like opening and closing quote (both quotes in code I think are the same symbols) - so probably it's not part of my code is visible in UI as one might think...
.
Is this a bug? Or undocumented feature?
After copying and inserting instances I am getting strange duplicate values in arrays before saving.
My models:
@Model
class Car: Identifiable {
@Attribute(.unique)
var name: String
var carData: CarData
func copy() -> Car {
Car(
name: "temporaryNewName",
carData: carData
)
}
}
@Model
class CarData: Identifiable {
var id: UUID = UUID()
var featuresA: [Feature]
var featuresB: [Feature]
func copy() -> CarData {
CarData(
id: UUID(),
featuresA: featuresA,
featuresB: featuresB
)
}
}
@Model
class Feature: Identifiable {
@Attribute(.unique)
var id: Int
@Attribute(.unique)
var name: String
@Relationship(
deleteRule:.cascade,
inverse: \CarData.featuresA
)
private(set) var carDatasA: [CarData]?
@Relationship(
deleteRule:.cascade,
inverse: \CarData.featuresB
)
private(set) var carDatasB: [CarData]?
}
The Car instances are created and saved to SwiftData, after that in code:
var fetchDescriptor = FetchDescriptor<Car>(
predicate: #Predicate<Car> {
car in
car.name == name
}
)
let cars = try! modelContext.fetch(
fetchDescriptor
)
let car = cars.first!
print("car featuresA:", car.featuresA.map{$0.name}) //prints ["green"] - expected
let newCar = car.copy()
newCar.name = "Another car"
newcar.carData = car.carData.copy()
print("newCar featuresA:", newCar.featuresA.map{$0.name}) //prints ["green"] - expected
modelContext.insert(newCar)
print("newCar featuresA:", newCar.featuresA.map{$0.name}) //prints ["green", "green"] - UNEXPECTED!
/*some code planned here modifying newCar.featuresA, but they are wrong here causing issues,
for example finding first expected green value and removing it will still keep the unexpected duplicate
(unless iterating over all arrays to delete all unexpected duplicates - not optimal and sloooooow).*/
try! modelContext.save()
print("newCar featuresA:", newCar.featuresA.map{$0.name}) //prints ["green"] - self-auto-healed???
Tested on iOS 18.2 simulator and iOS 18.3.1 device. Minimum deployment target: iOS 17.4
The business logic is that new instances need to be created by copying and modifying previously created ones, but I would like to avoid saving before all instances are created, because saving after creating each instance separately takes too much time overall. (In real life scenario there are more than 10K objects with much more properties, updating just ~10 instances with saving takes around 1 minute on iPhone 16 Pro.)
Is this a bug, or how can I modify the code (without workarounds like deleting duplicate values) to not get duplicate values between insert() and save()?
Building an app, which worked fine until I updated to XCode 16.
The app parses data and saves it to SwiftData, and later that store is used for filtering in data.
If I create the store on iOS 18, the store created has issues with relationships, so filtering is not working (I hope that will be fixed in iOS 18.1), so I need to create the store on iOS 17.5.
But before saving the parsed objects to the SwiftData (store), I do the checking for dupes. And after Xcode 16 update that is not working anymore on iOS 17.5, (but this part is working fine under iOS 18):
Here is my object:
import Foundation
import SwiftData
@Model
class CaliberData: Identifiable {
var id: UUID = UUID()
var sizeHeights: [SizeObject]
var featuresABCDIds: [Int]
init(
id: UUID,
sizeHeights: [SizeObject],
featuresABCDIds: [Int],
) {
self.id = id
self.sizeHeights = sizeHeights
self.featuresABCDIds = featuresABCDIds
}
extension CaliberData: Equatable {
static func == (lhs: CaliberData, rhs: CaliberData) -> Bool {
lhs.featuresABCDIds == rhs.featuresABCDIds
&& lhs.sizeHeights == rhs.sizeHeights
}
}
SizeObject if needed:
@Model
class SizeObject: Identifiable, Equatable {
@Attribute(.unique)
var id: Float
@Relationship(inverse: \CaliberData.sizeHeights)
private(set) var caliberDataSizesX: [CaliberData]?
init(_ size: Float) {
self.id = size
}
}
When I am doing the caliberData1 == CaliberData2 comparison to remove dupes before inserting to the SwifData modelContext I am getting exception, and Xcode shows it inside getter part of this expanded section under sizeHeights definition:
@storageRestrictions(accesses: _$backingData, initializes: _sizeHeights)
init(initialValue) {
_$backingData.setValue(forKey: \.sizeHeights, to: initialValue)
_sizeHeights = _SwiftDataNoType()
}
get {
_$observationRegistrar.access(self, keyPath: \.sizeHeights)
return self.getValue(forKey: \.sizeHeights)
}
set {
_$observationRegistrar.withMutation(of: self, keyPath: \.sizeHeights) {
self.setValue(forKey: \.sizeHeights, to: newValue)
}
}
}
Following is the stacktrace:
#1 0x00000001cc168928 in ___lldb_unnamed_symbol4385 ()
#2 0x00000001cc163f34 in ___lldb_unnamed_symbol4354 ()
#3 0x00000001cc165fc4 in ___lldb_unnamed_symbol4369 ()
#4 0x00000001cc169dd4 in ___lldb_unnamed_symbol4403 ()
#5 0x00000001cc123854 in SwiftData.PersistentModel.getValue<τ_0_0, τ_0_1 where τ_1_0: SwiftData.RelationshipCollection, τ_1_1 == τ_1_0.PersistentElement>(forKey: Swift.KeyPath<τ_0_0, τ_1_0>) -> τ_1_0 ()
#6 0x0000000105eda3b0 in CaliberData.sizeHeights.getter at /var/folders/5y/vv3v98ms7jj3z4kj0f3d6f9h0000gq/T/swift-generated-sources/@__swiftmacro_11CaliberDataC11sizeHeights18_PersistedPropertyfMa_.swift:9
#7 0x0000000105ef1a84 in static CaliberData.== infix(_:_:) at ...
My assumption is that "it" thinks that object is already inside the modelContext, when it's actually not yet inserted there and should act like regular class (by regular, I mean - like not marked with @Model macro).
How can I do objects comparison on iOS 17.5 with Xcode 16 (before they are inserted in modelContext)? Any other options?