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

后端 未结 30 2510
鱼传尺愫
鱼传尺愫 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: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.

提交回复
热议问题