TestFlight build crashes from fetch descriptor

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 {
...
}

Refactoring fetchDescriptor to work as a fetch descriptor for Asset instead solved the crash

static func fetchDescriptor(nameStartingWith prefix: String) -> FetchDescriptor<Asset> {
        let predicate = #Predicate<Asset> { asset in
            asset.name.starts(with: prefix)
        }

        return FetchDescriptor<Asset>(predicate: predicate)
    }```

Did you test with the latest public release (iOS 26.4 and friends)? If the issue is still there, I’d suggest that you file a feedback report and share your report ID here.

For a workaround, you can probably try the following:

static func fetchDescriptor(nameStartingWith prefix: String) -> FetchDescriptor<Asset> {
	let predicate = #Predicate<Asset> {
		$0 is ColorAsset && $0.name.starts(with: prefix)
	}
	return FetchDescriptor<Asset>(predicate: predicate)
	...
}

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

TestFlight build crashes from fetch descriptor
 
 
Q