fastlane自动构建之路

1、安转falstlane

准备工作http://www.jianshu.com/p/78c3166be2f3

sudo gem install fastlane --verbose

fastlane env

更新fastlane
sudo gem update fastlane --verbose

Paste_Image.png

2,fastlane之前,怎么做自动化打包呢?

实际上xcrun已经可以不用了,直接用xcodebuild就可以完成打包和签名

xcodebuild -version
xcodebuild -list -json
xcodebuild -showsdks
xcodebuild -exportLocalizations -project GetIPa.xcodeproj 
xcodebuild -showBuildSettings -project  GetIPa.xcodeproj

xcodebuild -target GetIPa -project GetIPa.xcodeproj -configuration Debug  -sdk iphoneos10.1 
xcodebuild -target GetIPa -project Test.xcodeproj -configuration Release -sdk iphoneos10.1 CODE_SIGN_IDENTITY="xxx" PROVISIONING_PROFILE="xxx"  

xcodebuild -scheme GetIPa -project GetIPa.xcodeproj  -configuration Release  -sdk iphoneos10.1 build
xcodebuild -scheme GetIPa -project GetIPa.xcodeproj  -configuration Release  -sdk iphoneos10.1  archive
xcodebuild -scheme GetIPa -project GetIPa.xcodeproj  -configuration Debug  -sdk iphoneos10.1  archive

xcodebuild -exportArchive -archivePath /Users/xx/Library/Developer/Xcode/Archives/2016-11-08/GetIPa\\ 2016-11-8\\ 下午2.28.xcarchive  -exportPath ./export -exportOptionsPlist 'exportOptionsPlist.plist'

将xxx.app文件打包成xxx.ipa并输出到指定位置

xcrun -sdk iphoneos10.1 -v PackageApplication ./build/Release-iphoneos/Test.app -o ~/Desktop/ipa/Test.ipa

xcrun -sdk iphoneos10.1 -v PackageApplication /Users/xx/Library/Developer/Xcode/DerivedData/GetIPa-dzvmkwvbujtbikawudjxzjnuldka/Build/Products/Release-iphoneos/GetIPa.app/ -o ./export

3,理解苹果签名

签名选择项:PeronalTeam, Team区别
选择Team没错
PeronalTeam不是会员都可以免费真机调试。

Paste_Image.png

4,什么是dSYM

分析crash的, 符号文件,调试的时候可以进入内部代码
可以在 Build Settings 中,找到 Strip Debug Symbol During Copy 这个选项,确保这个选项的值设置为 NO

5,fastlane 下的工具独立出来使用

170多种呢

6,fastlane 一键自动化

gym, sigh, snapshot

//Appfile
for_lane :adhoc do
    app_identifier "com.abcydia.wechat.sharetimeline" 
    apple_id "xx" 
    team_id "9JVMQ7S4HD"
end

for_lane :test_flight do
    app_identifier "com.abcydia.wechat.sharetimeline" 
    apple_id "xx" 
    team_id "9JVMQ7S4HD"
end

//Fastfile
fastlane_version "1.106.2"
default_platform :ios
platform :ios do
  #用于传到自己的https服务器上用
  lane :adhoc do
    gym(
      scheme: "pp365",
      export_method:"ad-hoc",
      include_bitcode:false,
      include_symbols:false,
      output_directory:"./adhoc_outdir",
      configuration:"Release"
    )
  end
  #用于上传itc上用的,做发布或者testflight测试用
  lane :test_flight do
    gym(
      scheme: "pp365",
      export_method:"app-store",
      include_bitcode:false,
      include_symbols:false,
      output_directory:"./testflight_outdir",
      configuration:"Release"
    )
  end
end

你可能感兴趣的:(fastlane自动构建之路)