0

I have a project that uses SimulatorStatusMagic in the Debug configuration only. So my Podfile has the following line:

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

The app works fine in Simulator, but when I compile for my device or upload to iTunes, I get the following error:

Dyld Message: Library not loaded: @rpath/SimulatorStatusMagic.framework/SimulatorStatusMagic
Referenced from: /var/mobile/Containers/Bundle/Application/1E47674A-D9AB-4390-B365-85C1D9035624/

What am I doing wrong?

parleer
  • 1,220
  • 3
  • 12
  • 22
  • None of the existing CocoaPods "Dyld Library Not Loaded" answers on Stack Overflow helped you? – matt Mar 23 '16 at 13:48
  • No, they didn't. Look how crazy the answers are! So many different problems with similar error messages. http://stackoverflow.com/questions/26024100/dyld-library-not-loaded-rpath-libswiftcore-dylib – parleer Mar 23 '16 at 14:18

1 Answers1

1

I found a solution to my problem. In AppDelegate.swift, I have the following code:

    if (Helper.isUITest) {
        UIView.setAnimationsEnabled(false)
        SDStatusBarManager.sharedInstance().enableOverrides()
    }

Even though Helper.isUITest always returns false for Release builds, the compiler doesn't know that and still emits the metadata/code to dynamically load the SimulatorStatusMagic framework.

Wrapping the above code in #if DEBUG fixed the issue.

    #if DEBUG
    if (Helper.isUITest) {
        UIView.setAnimationsEnabled(false)
        SDStatusBarManager.sharedInstance().enableOverrides()
    }
    #endif
parleer
  • 1,220
  • 3
  • 12
  • 22