dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire Reason: image not found

橙三吉。 提交于 2019-11-28 22:24:09

问题


I'm using CocoaPods v0.36 with my Swift project and the following pods: Alamofire, CocoaLumberjack, SwiftyJSON.

Everything was fine till I used my Developer ID. Compiler started to have problems to compile the project, after some fixes and updates for CocoaPods my project compiles but at runtime I get the following error:

dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire   
Referenced from: /Users/Ivan/Library/Developer/Xcode/DerivedData/myApp-bsxfcnwqpaxnzbhencwzteasshzf/Build/Products/Debug/myApp.app/Contents/MacOS/myApp  
Reason: image not found

I read different posts related to this:

  • http://blog.cocoapods.org/CocoaPods-0.36/
  • http://samdmarshall.com/blog/swift_and_objc.html
  • https://github.com/Alamofire/Alamofire/issues/101

But none seems to solve the issue.

The only clue that I have is that the 3 frameworks are in red, so it seems that are not generated/linked.

Now, I've removed my Developer ID, but the issue is still there. Does anybody have an idea?


回答1:


dyld library not loaded @rpath/framework

please make sure that the framework is showing under target->general->embeded binaries and linked framework and libraries section

if not then add by clicking + sign add just add the framework only

done!




回答2:


Solved Below the steps I did:

  • pod deintegrate, pod update, pod install
  • Reimported the three swift library files (generated by cocoapods)
  • Imported the three frameworks only in the Linked Frameworks and Libraries
  • Full clean and a build



回答3:


we were running into this issue here at work and one person's project would run while the other would get this strange error.

We did some comparison and realized that error is being generated when in the Xcode project's target, under Build Phases its missing some of the run scripts that Cocoapods is supposed to generate.

Check your project to make sure that these 3 scripts are there

Check Pods Manifest.lock
 Embed Pods Frameworks
 Copy Pods Resources

If they aren't I've attached a screenshot of them so that you can add them manually




回答4:


Try this:

Find your Target --> Build Phases --> Add New Copy Files Phase -->Choose Destination Option,Frameworks --> Click add AFNetworking.framework --> ✓.




回答5:


Solved by Unchecking Copy Only when installing.




回答6:


Make sure you have set valid certificate and provisioning profile in XCode!




回答7:


I solved that trouble just by uncheck the "copy only when installing" on copy frameworks in Build Phases




回答8:


None of the other stuff worked for me. So what did solve it for me in the end was a change in the podfile. I changed the code for the target in which it happened to:

target 'UITests' do
inherit! :search_paths
end

After a pod install it finally worked.



来源:https://stackoverflow.com/questions/29485035/dyld-library-not-loaded-rpath-alamofire-framework-versions-a-alamofire-reason

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!