通过fastlane打包时是需要输出六位的验证码和APP的专用密码的,通过在环境变量中新增两个变量可以自动获取输入不用手动输入。
一、 设置App专用密码变量
1. 首先获取APP的专用密码
2. 打开环境变量文件.bash_profile
,它是隐藏文件。或者通过vim ~/.bash_profile
命令打开
3. 设置刚才生成的APP专用密码
export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=APP专用密码用横线分割的英文字母
二、设置6位验证码变量
终端输入命令获取变量值,将值放到环境变量中。
$ fastlane spaceauth -u 开发者账号
设置如下环境变量
export FASTLANE_SESSION='---\n- !ruby/object:HTTP::Cookie\n name: myacinfo\n value: DAWTKNV2ae1df26f7bfd1a3045d0bde3a4bc13927383c9379ca0f317dae727d5554fc8ae84fedd25014b207b71880209a07f89f8ab0c6aa84de4d36619b94a96ea7a1eeade9a61fe24eee710578be013e4acfca844bc471976e9d2b90f72a649e445d2c84c74a48dd070d6e19bbad65c444573d1ef6e52ca15b8ced43145c3858eba29104a916e8958524f58f3222a6532147abe3f7ed78408d41ceb2c47228d5ad74f3724cbb8b88225473914ee778888dd9b1a6a2e9e00eda33a9599d6111eccc55c06cb889eb31bdaa41ff4200a7861abc631c71a44985b1e8ec407334b0ac8907431373628e794540870c2945e63173ad70abcfdde524294f84ea8e71f4eed1f83d31643865393239346536363231313661636231306437633462373636616135366434616665333065MVRYV2\n domain: [apple.com](http://apple.com)\n for_domain: true\n path: "/"\n secure: true\n httponly: true\n expires: \n max_age: \n created_at: 2019-03-12 15:11:05.007570000 +08:00\n accessed_at: 2019-03-12 15:39:55.704789000 +08:00\n- !ruby/object:HTTP::Cookie\n name: dqsid\n value: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJBbUVfelc0d2hwRlY3eElFS2Vla0J3In0.CCeSNC4PcwTsnoU3cq-Hb5AxwJDv1GGz9qEXOREbA1k\n domain: [olympus.itunes.apple.com](http://olympus.itunes.apple.com)\n for_domain: false\n path: "/"\n secure: true\n httponly: true\n expires: \n max_age: 1800\n created_at: &1 2019-03-12 15:39:56.916465000 +08:00\n accessed_at: *1\n'
启动环境变量
source ~/.profile