一行命令解决 Codesign wants to access key “access” in your keychain

简介

最近在做一个自动化的iOS打包后台时,需要用到 shell 去调用 xcodebuild 去导出 ipa 包,打包时总是会跳出Codesign wants to access key “access” in your keychain的提示,无法使用 shell 去关闭这个提示框,如果不点击始终允许,那么就无法打出 ipa 来

image.png

解决方法

security set-key-partition-list -S apple-tool:,apple: -s -k keychainPass keychainName
复制代码

security set-key-partition-list 参数说明

我们在命令行中输入security set-key-partition-list,可以看到相关的参数说明

security  set-key-partition-list
Usage: set-key-partition-list [options...] [keychain]
    -a  Match "application label" string
    -c  Match "creator" (four-character code)
    -d  Match keys that can decrypt
    -D  Match "description" string
    -e  Match keys that can encrypt
    -j  Match "comment" string
    -l  Match "label" string
    -r  Match keys that can derive
    -s  Match keys that can sign
    -t  Type of key to find: one of "symmetric", "public", or "private"
    -u  Match keys that can unwrap
    -v  Match keys that can verify
    -w  Match keys that can wrap
    -S  Comma-separated list of allowed partition IDs
    -k  password for keychain (required)
If no keychains are specified to search, the default search list is used.
        Set the partition list of a key.
        
复制代码

关于apple-tool:,apple:是什么,哪里来的

当我在网上疯狂搜索这两个关键词的时候,并没有很好的回答,我在 stackoverflow 中找到了模糊的答案,关于apple-tool:,没有任何的文档说明,只是知道这样做可以生效,在此先留个坑
在此附上链接,感兴趣的话,可以进去看一下
image.png

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享