My app crashes on startup in iOS 26

I have an app with a small but devoted following. It has not been upgraded since 2022 and has been working very well. On iOS 26 it crashes almost at startup.

After hooking up to Xcode and running I get this message in the console:

objc[64686]: Class PSSegment is implemented in both /System/Library/PrivateFrameworks/PolarisGraph.framework/PolarisGraph (0x291ed9f78) and /private/var/containers/Bundle/Application/08486FCF-548A-467C-8BA3-D722734463FC/HikeTracker.app/HikeTracker.debug.dylib (0x101d309e8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.

PSSegment is the name of an entity in my Core Data managed object model. If I refactor it to P_Segment the app starts.

PolarisGraph means nothing to me.

The "PS" stands for Persistent Store, but in this case it seems that PolarisGraph is PSing in my sandbox. How can this happen?

I'll attach the longer message that comes with the crash.

Answered by DTS Engineer in 871073022

Three letter prefixes are the recommendation here to avoid runtime name collisions with Apple's system frameworks for exactly this reason, and that advice is in the Objective-C Programming Guide:

Two-letter prefixes like these are reserved by Apple for use in framework classes [...] Your own classes should use three letter prefixes.

— Ed Ford,  DTS Engineer

As far as I understand Core Data - and who really understands it, really? - an entity will have an ObjC class generated for it, so you've just unfortunately used a name that Apple is now using for a class in one of their private frameworks on iOS 26.

As you've seen, renaming your entity fixes the issue because your new entity's generated class no longer has the same name, and so the compiler isn't seeing two classes with the same name.

As a general rule, avoid using names anywhere in your code that start with three capital letters, i.e. PSSegment. It's tempting to use your own name to name classes, and in your case perhaps you would name something HHSegment (because: HeezerHiker). Apple use this convention, so you should try and avoid it. For example, NSString == NS String == NextStep String.

You could use something like HHEntitySegment, or the name of your app, i.e. MyAppSegment.

Three letter prefixes are the recommendation here to avoid runtime name collisions with Apple's system frameworks for exactly this reason, and that advice is in the Objective-C Programming Guide:

Two-letter prefixes like these are reserved by Apple for use in framework classes [...] Your own classes should use three letter prefixes.

— Ed Ford,  DTS Engineer

My app crashes on startup in iOS 26
 
 
Q