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

ぃ、小莉子 提交于 2019-11-28 00:14:32

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7074668/building-a-mac-os-x-cocoa-application-for-distribution-with-an-imported-framewor

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