framework打包步骤
项目中需要用到sdk的framework框架 因此涉及到打包(打framework的包)过程,因此下面说一下大致打包流程,并不是很完善,如有错误,请大神指正
首先安装pod(具体pod安装过程可以百度),验证pod是否安装成功 打开终端 输入 pod 出现以下表示已经安装成功
xxxdeMac-mini:~ xxx$ pod
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
+ cache Manipulate the CocoaPods cache
+ deintegrate Deintegrate CocoaPods from your project
+ env Display pod environment
+ init Generate a Podfile for the current directory
+ install Install project dependencies according to versions from a
Podfile.lock
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new
Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
然后你可以看下你的pod版本是不是最新的 终端输入pod --version
查看源是哪里的话 终端输入 gem sources -l 此时可能会输出 *** CURRENT SOURCES ***
接下来可以看下gem 是不是最新的,更新gem需要终端输入 sudo gem update --system 如果是最新的会输出Latest version currently installed. Aborting.
接下来安装cocoapods 在此过程中可能会碰到被墙的情况,因此可能需要先翻墙,之前淘宝taobao Gems 源已停止维护,现由 ruby-china 提供镜像服务。可参考https://www.oschina.net/news/71749/taobao-gems-ruby-china,
这是淘宝的
xxxdeMac-mini:~ xxx$ gem sources -a https://ruby.taobao.org/
Error fetching https://ruby.taobao.org/:
Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://ruby.taobao.org/specs.4.8.gz)
现在可用如下的
xxxMac-mini:~ xxx$ gem sources -a https://gems.ruby-china.org/
https://gems.ruby-china.org/ added to sources
如果翻墙成功,此时在查看gem sources -l 会出现
xxxdeMac-mini:~ LGSC$ gem sources -l
*** CURRENT SOURCES ***
如上即代表翻墙成功
接着终端输入sudo gem install cocoapods 来安装cocoapods
xxxdeMac-mini:~ xxx$ sudo gem install cocoapods
Password:
Fetching: concurrent-ruby-1.0.2.gem (100%)
Successfully installed concurrent-ruby-1.0.2
Parsing documentation for concurrent-ruby-1.0.2
Installing ri documentation for concurrent-ruby-1.0.2
1 gem installed
出现如上代表安装成功
然后安装cocoapods-packager (终端执行以下命令sudo gem install cocoapods-packager)
xxxdeMac-mini:~ xxx$ sudo gem install cocoapods-packager
Password:
Fetching: cocoapods-packager-1.4.0.gem (100%)
Successfully installed cocoapods-packager-1.4.0
Parsing documentation for cocoapods-packager-1.4.0
Installing ri documentation for cocoapods-packager-1.4.0
1 gem installed
安装cocoapods-packager成功后 找到要打包的项目文件夹 cd 文件夹位置
然后命令行输入pod package 你项目名字.podspec --force --embedded
xxxdeMac-mini:你项目名字 xxx$ pod package 项目名字.podspec --force --embedded
xxxMac-mini:你项目名字 xxx$ pod package 项目名字.podspec --force --embedded
Analyzing dependencies
Fetching podspec for `HubeiMobileNewsSDK` from `hubeimobilenewssdk.podspec`
Downloading dependencies
Installing AFNetworking (2.6.3)
Installing 项目名字 (1.0.0)
Password:
Installing MBProgressHUD (0.9.2)
Installing MJRefresh (3.1.7)
Installing SDWebImage (3.7.6)
Generating Pods project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 5 total pods installed.
Building framework 项目名字 (1.0.0) with configuration Release
Mangling symbols
Building mangled framework
出现如上代码打包成功,在你项目文件夹下可找到打出的包,中间有很多步骤可能没写,只是写了大概步骤,如有错误希望各位大神多多指教