iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

后端 未结 30 2476
鱼传尺愫
鱼传尺愫 2020-11-22 10:08

This crash has been a blocking issue I used the following steps to reproduce the issue:

  • Create a Cocoa Touch Framework project
  • Add a swift file and a
相关标签:
30条回答
  • 2020-11-22 10:51

    In my case, my project is written by objective-c and in the library there are Swift files. So I changed "Always Embed Swift Standard Libraries" in my project’s Build Settings tab to Yes and it became totally okay.

    0 讨论(0)
  • 2020-11-22 10:51

    The simple solution is follow this screenshot then crash will go away:

    Noted: This is Xcode 11.5

    0 讨论(0)
  • 2020-11-22 10:52

    For iOS greater than or equal to 8

    Under the target's General tab, in the Embedded Binaries section add the framework. This will copy the framework into the compiled so that it can be linked to at runtime.

    enter image description here

    Why is this happening? : because the framework you are linking to is compiled as a dynamically linked framework and thus is linked to at runtime.

    ** Note:** Embedding custom frameworks is only supported in iOS > 8 and thus an alternative solution that works on older versions of iOS follows.

    For iOS less than 8

    If you influence this framework (have access to the source code/build process) you may change this framework to be statically linked rather than dynamically linked. This will cause the code to be included in your compiled app rather than linked to at runtime and thus the framework will not have to be embedded.

    ** How:** Under the framework's Build Setting tab, in the Linking section, change the Mach-O Type to Static Library. You should now not need to include the framework under embedded binaries.

    Static Framework

    Including Assets: To include things such as images, audio, or xib/nib files I recommend creating a bundle (essentially a directory, more info here bit.ly/ios_bundle) and then load the assets from the bundle using NSBundle.

    0 讨论(0)
  • 2020-11-22 10:54

    I got same kind of issue in iOS 9.x version

    ISSUE IS: App crashes as soon as I open the app with below error.
    
    dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications Referenced from: /var/containers/Bundle/Application/######/TestApp.app/TestApp Reason: image not found

    I have resolved this issue by changing Required to Optional in Linked Frameworks and Libraries for UserNotifications.framework framework.

    0 讨论(0)
  • 2020-11-22 10:55

    Firstly Try to build after Command+Option+Shift+K .If still fails then do below steps.

    If anybody is facing this error in Xcode 8 then change your framework status to Optional instead of Required under the General Tab of your target.

    0 讨论(0)
  • 2020-11-22 10:55

    My environment: Cocos2d 2.0, Box2d, Objective C

    In addition to doing the other answers above I finally went to the General tab and made WatchKit Optional.

    0 讨论(0)
提交回复
热议问题