iPhone Project Dependency Management

后端 未结 2 1133
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 18:24

Has anyone had any success in finding a reliable, generalised solution for managing dependencies for iPhone projects? I\'m looking to split my iPhone applications up into reusab

相关标签:
2条回答
  • 2021-02-04 18:25

    The way I've done it in the past is as follows:

    • Static Library for shared code
    • Bundle for Images / Data Files / Etc (Non Code)

    By doing this, you only ever have to worry about updating the project that manages your static library / bundle and not the applications that use them.

    The key thing to creating a bundle, is that Bundles are not listed under iOS when adding a new target to a project. Instead they are listed under Mac OS X. Don't worry, it works great.

    Once you've created your Bundle and Static Library targets, you'll need to get those into your application:

    • Add the Static Library under Link Binary With Libraries (Xcode 4)
    • Add the Bundle under Copy Bundle Resources (Xcode 4)

    The final thing to keep in mind is that when you want to load resources from the newly created bundle you need to do something like the following if you were going to load an image:

    UIImage *myImage = [UIImage imageNamed:@"YourBundle.bundle/MyImage.png"];

    0 讨论(0)
  • 2021-02-04 18:27

    With Static Libraries, you can distribute the XIB's/Images/Strings in a Bundle Folder which can be imported easily. It is the easiest approach I've found for distributing dependencies short of distributing the actual Code/Xcode Project

    0 讨论(0)
提交回复
热议问题