shinydevelopment / SimulatorStatusMagic

Clean up your status bar for taking screenshots on the iOS simulator.
MIT License
2.35k stars 140 forks source link

Non-public API usage warning #47

Closed TimMumsnet closed 7 years ago

TimMumsnet commented 7 years ago

When attempting to upload my app to ITC, I received an email informing me:

Non-public API usage: The app contains or inherits from non-public classes in Frameworks/SimulatorStatusMagiciOS.framework/SimulatorStatusMagiciOS: UIStatusBarServer

I've imported the SimulatorStatusMagic project, added SimulatorStatusMagiciOS.framework as an embedded binary. To ensure I don't include the framework in the submission, I only import the framework on the debug config, but I think I'm missing something...

kenji21 commented 7 years ago

embedding the framework makes it being copied within the folder "YourApp.app/Framework", and so uploaded to ITC A solution can be to rm -R it in a script build phase after the "embed framework" one, removing it only when:

if [ "$ACTION" == "install" ] ; then
     rm ....
fi
FelixLisczyk commented 7 years ago

@kenji21 's solution worked for me, here's the complete command:

rm -R ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SimulatorStatusMagic.framework

Instead of using the if clause you can also check the box 'Run script only when installing'.


Edit: The submission worked, but the app crashes at launch (Library not loaded).

I've managed to solve the issue in my CocoaPods configuration:

pod 'SimulatorStatusMagic', :configurations => ['Debug']

This way the framework isn't included when I archive the app with 'Release' configuration.

The framework calls and import statements can be toggled with a Swift compiler flag. For example, I've defined a compiler flag -D CONFIGURATION_$(CONFIGURATION) for my project, which I can use in code like this:

#if CONFIGURATION_Debug
    import SimulatorStatusMagic
#endif

...

#if CONFIGURATION_Debug
    SDStatusBarManager.sharedInstance().enableOverrides()
#endif
TimMumsnet commented 7 years ago

@FelixII - this is perfect, it's submitting without errors now. Thanks!