I have a FetchDescriptor that uses starts(with:) which works fine in debug builds but crashes in TestFlight and archive. For background information I'm using iCloud and model inheritance where the property being used in fetch descriptor is defined on the superclass, the fetch descriptor is for the subclass.
Implementation:
static func fetchDescriptor(nameStartingWith prefix: String) -> FetchDescriptor<ColorAsset> {
let predicate = #Predicate<ColorAsset> { asset in
asset.name.starts(with: prefix)
}
return FetchDescriptor<ColorAsset>(predicate: predicate)
}
@Model
public class Asset: Identifiable {
// MARK: - Properties
var name: String = ""
....
}
@available(macOS 26.0, *)
@Model
public class ColorAsset: Asset {
...
}