Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a Mac OS X/Cocoa application for distribution with an imported framework

So I built an application which compiles and runs fine from Xcode. Now I want to distribute it to other people so they can use it. How do I do that correctly?

I thought it was as simple as archiving it, and then sharing it as a .pkg or an application. But whenever I open up the application it crashes with the following message:

Application Specific Information: 
dyld: launch, loading dependent libraries 
Dyld Error Message: 
  Symbol not found: _OBJC_CLASS_$_CPTBorderedLayer 
  Referenced from: /Users/USER/Desktop/StoreMon.app/Contents/MacOS/ 
StoreMon 
  Expected in: /Library/Frameworks/CorePlot.framework/Versions/A/ 
CorePlot 
 in /Users/USER/Desktop/StoreMon.app/Contents/MacOS/StoreMon 

I am using the Core Plot framework.

The _CPTBorderedLayer class is part of that framework. How do I package this framework into my app correctly?

like image 221
dpham Avatar asked Aug 16 '11 07:08

dpham


1 Answers

You can provide an installer for the framework(s) you are using, or you can embed them in your Application's bundle.

Read the "Framework Programming Guide". Page 41 is what you are looking for:

http://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/BPFrameworks.pdf

The trick is to copy the framework files in a special directory, inside your application. Then, you'll use @executable_path to refer to your application's binary path, so the application's will be correctly linked to your framework at launch time.

like image 51
Macmade Avatar answered Oct 06 '22 23:10

Macmade