Trouble embedding a framework in an application
Trouble embedding a framework in an application
- Subject: Trouble embedding a framework in an application
- From: Tito Ciuro <email@hidden>
- Date: Wed, 02 Jun 2010 11:16:07 +0200
Hello,
I'm having some trouble embedding a framework in my app. I've done that countless times before in other projects and it worked fine, but for some reason, it doesn't work this time around. I don't know what I'm missing and I get the feeling I'm running in circles. The app launches (and works) fine if I launch it from Xcode. However, if I launch from Finder I see the following in Console.app
> 6/2/10 11:05:46 AM [0x0-0x192192].com.yourcompany.RichEmailSender[4390] dyld: Library not loaded: @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon
> 6/2/10 11:05:46 AM [0x0-0x192192].com.yourcompany.RichEmailSender[4390] Referenced from: /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> 6/2/10 11:05:46 AM [0x0-0x192192].com.yourcompany.RichEmailSender[4390] Reason: image not found
> 6/2/10 11:05:46 AM com.apple.launchd.peruser.501[143] ([0x0-0x192192].com.yourcompany.RichEmailSender[4390]) Job appears to have crashed: Trace/BPT trap
> 6/2/10 11:05:46 AM ReportCrash[4393] Saved crash report for RichEmailSender[4390] version ??? (???) to /Users/tciuro/Library/Logs/DiagnosticReports/RichEmailSender_2010-06-02-110546_TurboMonkey.crash
> 6/2/10 11:08:34 AM RichEmailSender[4441] *** Assertion failure in -[MessageExample createMessage], /Users/tciuro/Desktop/RichEmailSender/MessageExample.m:23
> 6/2/10 11:08:34 AM RichEmailSender[4441] could not load image
The crash referenced above shows:
> Process: RichEmailSender [4390]
> Path: /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> Identifier: com.yourcompany.RichEmailSender
> Version: ??? (???)
> Code Type: X86 (Native)
> Parent Process: launchd [143]
>
> Date/Time: 2010-06-02 11:05:46.302 +0200
> OS Version: Mac OS X 10.6.3 (10D573)
> Report Version: 6
>
> Exception Type: EXC_BREAKPOINT (SIGTRAP)
> Exception Codes: 0x0000000000000002, 0x0000000000000000
> Crashed Thread: 0
>
> Dyld Error Message:
> Library not loaded: @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon
> Referenced from: /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> Reason: image not found
I have googled for info and I've seen a lot of info (and misinformation as well), so I tried the following:
1) Drag the frameworks (EDMEssage + EDCommon) to my Xcode project
2) Added a Copy Files Build Phase to the target
3) Selected Frameworks from the popup and checked Copy only when installing (info window of the Copy Files Build Phase)
4) Set the Runpath Search Paths to @loader_path/../Frameworks/
Running otool -l shows the following:
> TurboMonkey:~ tciuro$ otool -L /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender:
> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
> @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon (compatibility version 34.0.0, current version 34.0.0)
> @executable_path/../Frameworks/EDMessage.framework/Versions/A/EDMessage (compatibility version 17.0.0, current version 17.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
> /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.19.0)
> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.21.0)
> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.29.0)
> TurboMonkey:~ tciuro$
The contents of the built app show:
> Last login: Wed Jun 2 11:11:14 on ttys000
> TurboMonkey:~ tciuro$ cd /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app
> TurboMonkey:RichEmailSender.app tciuro$ cd Contents/
> TurboMonkey:Contents tciuro$ ls -al
> total 16
> drwxr-xr-x 7 tciuro staff 238 Jun 2 11:08 .
> drwxr-xr-x 3 tciuro staff 102 Jun 2 11:08 ..
> drwxr-xr-x 4 tciuro staff 136 Jun 2 11:08 Frameworks
> -rw-r--r-- 1 tciuro staff 906 Jun 2 11:08 Info.plist
> drwxr-xr-x 3 tciuro staff 102 Jun 2 11:08 MacOS
> -rw-r--r-- 1 tciuro staff 8 Jun 2 11:08 PkgInfo
> drwxr-xr-x 4 tciuro staff 136 Jun 2 11:08 Resources
> TurboMonkey:Contents tciuro$ cd Frameworks/
> TurboMonkey:Frameworks tciuro$ ls -al
> total 0
> drwxr-xr-x 4 tciuro staff 136 Jun 2 11:08 .
> drwxr-xr-x 7 tciuro staff 238 Jun 2 11:08 ..
> drwxr-xr-x 6 tciuro staff 204 Jun 2 11:08 EDCommon.framework
> drwxr-xr-x 6 tciuro staff 204 Jun 2 11:08 EDMessage.framework
> TurboMonkey:Frameworks tciuro$
So the frameworks are there and supposedly referenced correctly. Then... why can't the library be loaded? Is there anything else I need to do? Anything else I'm perhaps missing? If you need to see the project, please contact me offline, as I don't want to spam the list with my stuff.
Thanks in advance,
-- Tito
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden