开发者

How do I package an SDK (static lib + xibs) for the iPhone?

I am creating an SDK for a client that includes predefined view controllers. What is the recommended way to package everything (static lib, .xib(s), and .png(s)) for easy use?

SDKs that I've used (e.g. Pinch Media) do a good job of just providing a .h and .a file that expose only user accessible functionality and hiding everything else. As I read Apple's documentatio开发者_StackOverflown, a framework would be ideal but is not permitted on iPhoneOS.

Some key requirements:

  1. Don't expose source or object internals.
  2. Be easy to use & set up.
  3. Work on both the device and simulator.

Thanks!


Frameworks would be ideal, but as you said, aren't allowed on the iPhone. I think in the end you'll need to provide at least 3 files: a header file, a static library, and a resource bundle.

The header file would simply have all the API's you do want to expose. If you have multiple classes you may want to provide multiple headers.

For the static library I recommend compiling it like normal for each architecture (Device and Simulator), and then use lipo to combine them like so (replacing paths as necessary):

lipo -create -output output/file/path device/file/path simulator/file/path

With the bundle you can make a new target in Xcode to create a bundle, but really it's just a folder. You would also need to make you're SDK know how to load the bundle, and get to the resources. You can't load executable code from the bundle however; that is the reason frameworks don't work on the iPhone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜