Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

objective c - "image not found" Error while using Custom FrameWork

I created my own framework for one of my cocoa application. I added that framework to my project and called a method from that framework. When I tried to run my application it crashed:

Crash Log:

dyld: Library not loaded: @rpath/MMP.framework/Versions/A/MMP
  Referenced from: /Users/Midhun/Library/Developer/Xcode/DerivedData/MMPTest-ccvjtgedqkcftchapjehhwjbaqdq/Build/Products/Debug/MMPTest.app/Contents/MacOS/MMPTest
  Reason: image not found

What I have done:

FrameWork:

  • I added my header file in public section

Public Header

  • I added the paths of Deployment and Linking like:

Paths

  • I build the project and I got my framework ready (Pretty cool till here).

Project:

  • I added that framework to FrameWorks folder under my Project's root directory.
  • I added the framework under Link Binary With Libraries Section
  • I changed the path of Linking like: Changed Path

Platform Details:

Xcode: 4.6.2
OS X : 10.8

What I have tried (After the crash)

  • When I get this issue, I checked with otool. It shows the paths like:

otool

But I couldn't fix the issue, yet. Please help me, thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Set framework installation directory to @executable_path/../Frameworks

enter image description here

Now add copy files in your build phase, set destination to Frameworks. click on your target, then on Editor (menu bar) --> Add build phase --> Add Copy Files Build Phase

enter image description here

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...