Reproduced, please indicate the source: https://www.cnblogs.com/tony-17/p/11276027.html
Source compiled and produced a static library
- Download cordova-ios source code available for download at: cordova-ios
- After extracting for use Xcode, compiling the selected emulator and Generic iOS Device, cmd + B, compiled successfully (Dynamic, Static available) can;
3. Use the lipo command, merge Cordova.framework
Cordova.framework files in the selected Products, Show in Finder to locate the file
If the project is compiled successfully, you should have two folders, I use the bebug mode, there is a Debug-iphoneos and Debug-iphonesimulator two folders
The Products folder Copy out using a terminal tool, merge
After the merger is successful, the emergence of new files for supported architecture
We can see the simulator and the real machine;
After Cordova This binary file into any of a Cordova.framework under Products, replacing the old exec file;
Podspec production, support the introduction of pod
Prerequisite: you need to install the cocoapods
Create a new folder as CordovaiOSSDK, input terminal
pod spec create Cordova
After generates a C ordova.podspec file, the next step is to modify the file, find a handy editor used here is sublime text 3
Open podspec file, see the contents, more comments, all comments will be deleted, as follows:
Pod::Spec.new do |s| s.name = "Cordova" s.version = "4.5.4" s.summary = "基于cordova-ios 4.5.4封装的cordova sdk." s.homepage = "https://gitee.com/rayz-plugins-specs/cordova-ios-sdk" s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.author = { "rayz_17" => "[email protected]" } s.platform = :ios, "9.0" s.source = { :git => "https://gitee.com/rayz-plugins-specs/cordova-ios-sdk.git", :tag => "#{s.version}" } s.requires_arc = true s.source_files = "*.framework/Headers/*.h" s.public_header_files = "*.framework/Headers/*.h" s.vendored_frameworks = "*.framework" s.frameworks = "AVFoundation", "AssetsLibrary", "CoreLocation", "MobileCoreServices", "Security", "SystemConfiguration", "AdSupport" end
说明:
- 在github、gitee、gitlab等网页端创建一个cordova仓库,将本地文件上传到仓库中;
- 将合并后生成的framework用pod语法链接进去;
- 校验一下私有库是否可用`pod spec lint Cordova.podspec --allow-warnings`
如果不使用.framework,而又想使用pod引入,则在源码目录下创建podspec文件进行支持,其中核心部分如下: