Build and use dylib on iOS
来源:互联网 发布:汶上县网络问政平台 编辑:程序博客网 时间:2024/06/06 08:51
http://blog.iosplace.com/?p=33
Xcode 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
- C++ 语言基础
- 缓存、缓存算法和缓存框架简介
- 【phpcms-v9】phpcms-v9中添加广告联盟代码
- asp.net序列化json三种方式 jquery ajax json
- 【OpenCV学习笔记】之二:Mat使用的潜规则----对数据类型敏感
- Build and use dylib on iOS
- vc++之调用CloseHandle的原因
- System.map详解
- OpenWRT文章翻译之(一)----OpenWRT Buildroot简介
- TITAN
- JS阻止用户默认事件的发生
- 2012-06-14 19:16 ios消息推送机制原理与实现
- POJ1094 字母排序(拓扑排序)
- ubuntu下乱码问题解决方案