126
votes

I can't find anywhere what the -all_load flag do when compiling Objective-C code.

I have some issues uploading binaries to Apple, the they say it's because I didn't use this flag, but my code compiles even without it.

Can some one help me with that?

Thanks

1
Typically, any errors you see with this occur on the device when running the application. Are you saying that you didn't test your application on actual hardware before submission for review by Apple? If so, that's a very, very bad idea. - Brad Larson♦
I've tested it, however my "distribution" configuration - the one with the app store provisioning profile - didn't had the flag and all of the tests were done using the development profile which had the flag so everything seems ok, and when I compiled it for the app store with the distribution profile the flag was off, and because the distribution profile can't be installed locally i couldn't check it. - Guy Ephraim

1 Answers

147
votes

It is probably related to this technical note https://developer.apple.com/library/content/qa/qa1490/_index.html

IMPORTANT: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags. -all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.