Skip to content

"The app references non public selectors" warning

Nikhil edited this page Aug 20, 2014 · 2 revisions

Some users are receiving the following warning when submitting their apps to the app store:

The app references non-public selectors in ${APP_NAME}: entityName:, insertInManagedObjectContext

It is safe to ignore this warning — Apple is not rejecting apps that use this selector.

Why is it showing a warning?

Jon "Wolf" Rentzsch did some sleuthing and found the following information:

When generating class files to represent your data model’s entities, mogenerator writes a few convenience class methods for you:

+ (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_;
+ (NSString*)entityName;
+ (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_;

These handy class methods allow you to write something like this:

[MyEntity insertInManagedObjectContext:moc];

to create a new instance. Contrast with:

[NSEntityDescription insertNewObjectForEntityForName:@"MyEntity" inManagedObjectContext:moc];

The mogenerator way is more obvious, less code and not stringly typed.

So that’s the backgrounder.

The good news is Apple likes mogenerator so much that they used it to implement iOS’s PhotoLibraryServices.framework.

The bad news is that PhotoLibraryServices.framework is a private framework.

As a first line of defense against naughty developers submitting apps that use undocumented APIs, Apple sweeps up every selector (method name) defined in all private frameworks and puts them on a special list. The “non-public selectors” list.

Unfortunately this includes the convenience methods mentioned above. If your App Store submission is found to be use non-public selectors Ap ple may do nothing, issue a warning or reject your submission altogether.