微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios自动打包-fastlane 安装、使用、更新和卸载

ios自动打包使用fastlane


 

1、首先安装xcode

首先检查是否已经安装 Xcode 命令行工具,fastlane 使用 xcodebuild 命令进行打包,运行 xcode-select --install 命令,根据你的情况进行不同处理。

 

2、没有弹出提示,命令行提示 xcode-select: note: install requested for command line developer tools, 则需要运行下面命令,指定 Xcode 命令行工具所在的路径。

$ xcode-select -p  // 打印 Xcode 开发目录
/Applications/Xcode.app/Contents/Developer
$ xcode-select --switch /Applications/Xcode.app/Contents/Developer //进行选择



安装 fastlane:
sudo gem install fastlane --verbose

安装成功后查看版本:fastlane --version



初始化:fastlane
进入项目目录,进行初始化操作

fastlane init

选择4、进行自定义操作

补充:
1.fastlane 初始化认会创建三个文件:Fastfile、Appfile、Deliverfile;两个文件夹:Metadata、screenshots
2.Fastfile : 核心文件,主要用于 命令行调用和处理具体的流程,lane相对于一个方法或者函数
3.Appfile : 存储有关开发者账号相关信息
4.Deliverfile: deliver工具的配置文件

 



安装蒲公英的 fastlane 插件
$ fastlane add_plugin pgyer

 

安装gym工具

<style></style>

sudo gem install gym

 


 


打包前,需要开发进行xcode证书配置完成
配置完成后,mac电脑上需要进行一次完整打包过程才可以


脚本是初始化生成文件,如
<style></style>

/Users/shangying/ios-workspace/syhospital-p-ios/fastlane

 

 


脚本配置:

<style></style>

macos:fastlane SY$ vim Fastfile 

 

default_platform(:ios)

  

platform :ios do

 

desc "Description of what the lane does"

 

 

lane :p do

 

gym(

    clean:true,

    scheme:"sy_user_ios_qa",

 

    export_method:"ad-hoc",

    #output_name: output_name,

    output_directory:"./build",

 

   )

   pgyer(api_key: "9b0d93c5............5d0", user_key: "e60b..............b2f4275df4d31")

 

end

 

end

 

appfile文件里写id
如:
<style></style>

app_identifier "com.syxxxxxx.user"

 


编写脚本进行执行如:
<style></style>

macos:scripts SY$ cat ios-p-app.sh 

#!/bin/bash

cd /Users/shangying/ios-workspace/syhospital-p-ios

git checkout qa

git pull

fastlane p

 





异常:

如果打包出现异常,提示权限不正确解决方案:

添加命令 security unlock-keychain -p password /Users/username/Library/Keychains/Login.keychain
https://www.jianshu.com/p/b03e59560d31


lane的名称一定不能有特殊符号如-等,需要为str字符串类型(巨坑)



参考文档:

http://www.cocoachina.com/ios/20180516/23396.html
https://www.jianshu.com/p/9d53836a3b64
http://www.cocoachina.com/ios/20150728/12733.html

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐