WEB开发网
开发学院手机开发iPhone 开发 How to (almost) create your own iPhone OS fram... 阅读

How to (almost) create your own iPhone OS framework

 2010-04-19 16:13:00 来源:WEB开发网   
核心提示:point, your project should look something like this:Step 2: Merge library files for different platforms into one.There is a command line tool called 'lipo&#
point, your project should look something like this:

Step 2: Merge library files for different platforms into one.

There is a command line tool called 'lipo' that allows you to combine different .a files into one. It comes for free with the SDK. Using a custom build target, we can execute that command after everything got built by the compiler/linker. Now, create a new "Shell Script" build target, we'll call it 'Build ALL'. This will allow us to call the 'lipo' tool during build time. Drag the other static library build targets (not the actual .a files) into the new target - this will make sure that our lib files get built before we bundle them up. Expand 'Build ALL' and double-click on "Run Script". In the window that opens up, paste the following shell script:

# remove existing product lib file, just in caserm -rf build/${BUILD_STYLE}-iphoneos/libPseudoFramework-${BUILD_STYLE}.a# combine lib files for various platforms into onelipo -create "build/${BUILD_STYLE}-iphoneos/libPseudoFramework dev.a" "build/${BUILD_STYLE}-iphonesimulator/libPseudoFramework sim.a" -output build/${BUILD_STYLE}-iphoneos/libPseudoFramework-${BUILD_STYLE}.a

In the dropdown box on top, select 'Use project settings' for Active SDK and 'Debug' for Active Configuration. Now, when you right-click on 'Build ALL' target and select "Build", both 'sim' and 'dev' lib files should be built along with the combined 'libPseudoFramework-Debug.a' file, which you should be able to find under 'build/Debug-iphoneos' folder in your project directory. This is the debug version of the library, with debug symbols and all that stuff. If you change Active Configuration to Release and run 'Build ALL' again, a release version will show up as 'build/Release-iphoneos/libPseudoFramework-Release.a'. These are the library files that you can now use in other projects.

Tags:How to almost

编辑录入:coldstar [复制链接] [打 印]
赞助商链接