dyld: Library not loaded: @rpath/XXXX Reason: image not found

制作了一个Framework(XBPrivate.framework),真机测试的时候,出现了如下的错误:

dyld: Library not loaded: @rpath/XBPrivate.framework/XBPrivate
  Referenced from: /private/var/mobile/Containers/Bundle/Application/324452CF-B0BE-44DD-A480-67389DD0AB76/MainProject.app/MainProject
  Reason: image not found

找寻了很多,最终发现是添加Framework的方法不对,应该是在:
Targets->General->Embeded Binaries 里添加我们制作的Framework,添加之后的效果如下:
dyld: Library not loaded: @rpath/XXXX Reason: image not found_第1张图片
添加到 Embeded Binaries里之后,系统会自动将其也添加到 Linked Frameworks and Libraries里面,将Framework从Linked Frameworks and Libraries删除,对程序也没什么影响

你可能感兴趣的:(iOS)