Build and use dylib on iOS
来源:互联网 发布:用ps做淘宝产品图片 编辑:程序博客网 时间:2024/06/14 05:17
Build and use dylib on iOS
October 1st, 2010Xcode does not allow you to build dylib for iOS. App will be rejected if it’s not single binary. But I have an application that has plug-in architecture to load optional modules. I just want a quick prototype to prove concept before fully port it to iOS. It’s faster to do if dylib could simply work. So, this post shows how to build and use dylib but be aware it won’t be approved to App Store. (Tested with Xcode 3.2.4 on 10.6.4)
1. Open these files in the Property List Editor: “/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX Product Types.xcspec” and “/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/iPhone Simulator ProductTypes.xcspec”
2. Locate the item in the “MacOSX Product Types.xcspec” that has the product type “com.apple.product-type.library.dynamic” and drag it to the “iPhone Simulator ProductTypes.xcspec”.
3. Open “MacOSX Package Types.xcspec” and “iPhone Simulator PackageTypes.xcspec” found at the same places.
4. Locate the item in the “MacOSX Product Types.xcspec” that has the package type “com.apple.package-type.mach-o-dylib” and drag it to the “iPhone Simulator PackageTypes.xcspec”.
5. Repeat the steps for the “iPhoneOS.platform” and relaunch Xcode if it was running.
Now, lets build a dylib. Start out with the “Cocoa Touch Static Library” Templete. That should included the Foundation.framework in the project. Here are the changes I made on top of the templete to build dylib.
1. Open the file “project.pbxproj” (found inside the Xcode project file bundle) in a Text Editor. Search for string “producttype”, change it’s value to “com.apple.product-type.library.dynamic”;
Now, open the project with Xcode, go to Project->Edit Project Settings
2. “Installation Directory” set to @executable_path/ because I plan to put the dylib in the same directory as the app’s executable.
2. “Mach-O Type” set to Dynamic Library
3. “Executable Extension” set to dylib
4. “Executable Prefix” set to empty
5. Add one or two simple methods to the library and build it.
Now, create an app to test it. This time, I choose the “View-based Application”. Hook up a UIButton and a UILable to call the lib and showing return message. You can download the complete project TestApp and play with it.
- Build and use dylib on iOS
- Build and use dylib on iOS
- How To: Compile and Use Tesseract (3.01) on iOS (SDK 5)
- Xamarin.iOS Binding Notes about .dylib and clang compiler
- Use cp and mv carefully on Solaris.
- Compile and use PBRT on Ubuntu
- build boost_1_48 on ubuntu and windows
- mysql build and setup on linux
- How to build and use a Flash DLL
- Use Storyboards to Build Navigation Controller and Table View
- How to Build and Use libnetfilter_queue for Android
- HOWTO: Install, Build and Use openCV (MacOSX 10.10)
- HOWTO: Install, Build and Use openCV (MacOSX 10.10)
- HOWTO: Install, Build and Use openCV (MacOSX 10.10)
- 活动的使用how to build and use an activity
- IOS Create a Label and use bundle
- How to use Facebook iOS SDK on iOS 10
- install and use junit on MAC without IDE
- ubuntu下widows盘符无法获得可执行权限的问题?
- Spring MVC 非注解方式 也可以注解和非注解结合使用
- 用GVim建立IDE编程环境(Win篇)
- WEB应用安全评估标准- OWASP ASVS的整理介绍
- linux下运行perl的命令
- Build and use dylib on iOS
- Android实现任务管理器
- js时间加减
- CornerStone配置SVN,HTTP及SVN简单教程
- Android开发之倒计时应用(三)
- 黑马程序员————IOS学习笔记 第12篇 关于单例设计模式的认识
- R语言多元统计分析初探
- 【ac自动机】uva11468 Substring && uva11019 Matrix Matcher
- 2阶段算法学习 。。