從命令行對ios app進行編碼

[英]Codesigning ios app from the command line


I'm working on creating a command line workflow for my ios development and I'm stuck at the last stage: codesigning.

我正在為我的ios開發創建一個命令行工作流程,我在最后階段陷入困境:代碼簽名。

I built an app for armv7 and armv7s, link it and create the app bundle:

我為armv7和armv7s構建了一個應用程序,鏈接它並創建應用程序包:

$ codesign -d -v path/to/myapp.app
Executable=/path/to/myapp.app/myapp
Identifier=com.mycompany.myapp
Format=bundle with Mach-O universal (armv7 armv7s)
CodeDirectory v=20200 size=2292 flags=0x0(none) hashes=105+5 location=embedded
Signature size=4332
Signed Time=Sep 7, 2014, 2:47:55 AM
Info.plist entries=26
TeamIdentifier=XXXXXX
Sealed Resources version=2 rules=5 files=3
Internal requirements count=1 size=192

I get a codesigning hash XXXXX from:

我得到了一個代碼簽名哈希XXXXX:

$ security find-identity -pcodesigning -v
  1) XXXXX "iPhone Developer: My Name (YYYY)"
     1 valid identities found

However, after I codesign using the following:

但是,在我使用以下代碼簽名后:

codesign --force -vvvv --sign XXXXX --resource-rules=path/to/myapp.app/ResourceRules.plist --entitlements path/to/myapp.xcent path/to/myapp.app
path/to/myapp.app: replacing existing signature
path/to/myapp.app: signed bundle with Mach-O universal (armv7 armv7s) [com.mycompany.myapp]

It still seems to be unhappy:

它似乎仍然不快樂:

$ codesign --verify -vvvv path/to/myapp.app
path/to/myapp.app: invalid Info.plist (plist or signature have been modified)
In architecture: armv7s

As a reference I built a (similar) app using xcode (I actually used the codesign line from the logs to sign this app), and it works just fine:

作為參考,我使用xcode構建了一個(類似的)應用程序(我實際上使用了日志中的codesign行來簽署這個應用程序),它工作得很好:

$ codesign --verify -vvvv path/to/otherapp.app
path/to/otherapp.app: valid on disk
path/to/otherapp.app: satisfies its Designated Requirement

I'm definitely sure that I have correct codesigning hash, since I have signed and deployed apps via xcode. I'm just trying to reproduce the same steps on the command line and failing miserably. Obviously if I changed info.plist or something, I would expect to see this error, but I don't expect to see it right after I do the codesign step. Some black magic is at work here. Could anyone shed some light or help with some pointers please?

我絕對相信我有正確的代碼簽名哈希,因為我已經通過xcode簽署和部署了應用程序。我只是試圖在命令行上重現相同的步驟並且失敗了。顯然,如果我更改了info.plist或其他內容,我希望看到此錯誤,但我不希望在執行代碼簽名步驟后立即看到它。一些黑魔法在這里工作。有人可以解決一些問題嗎?

EDIT:

I removed armv7s and just built armv7 and now it seems happy at the codesign verification stage, however I still can't deploy the app with the following error from the logs:

我刪除了armv7s並剛剛構建了armv7,現在看來在代碼簽署驗證階段很開心,但是我仍然無法從日志中部署以下錯誤:

installd[26777] : 0x10050c000 verify_signer_identity: MISValidateSignatureAndCopyInfo failed for /var/tmp/install_staging.Mvi7tR/myapp.app/myapp: 0xe8008019

installd [26777]:0x10050c000 verify_signer_identity:/var/tmp/install_staging.Mvi7tR/myapp.app/myapp:0xe8008019的MISValidateSignatureAndCopyInfo失敗

I have no idea what's going on :\

我不知道發生了什么事 :\

ANOTHER EDIT:

I got the codesign verification to fail again, heh. So, if I verify myapp.app, then it says everything is OK. However, if I try to verify myapp.app/myapp binary directly, then it says that verification failed (with the above error except for architecture armv7)

我讓代碼簽署驗證再次失敗,嘿。所以,如果我驗證myapp.app,那么它表示一切正常。但是,如果我嘗試直接驗證myapp.app/myapp二進制文件,則表示驗證失敗(除了架構armv7之外的上述錯誤)

1 个解决方案

#1


0  

Long story short, if I codesign myapp.app/myapp instead of myapp.app, then I can deploy the app to my phone without any issues. I can't seem to codesign both yet, as one of myapp.app/myapp or myapp.app fails codesign --verify, but it's good enough for now since I can deploy the app.

長話短說,如果我使用myapp.app/myapp而不是myapp.app進行編碼,那么我可以將應用程序部署到我的手機而不會出現任何問題。我似乎無法對兩者進行協同設置,因為myapp.app/myapp或myapp.app中的一個失敗了代碼簽名 - 驗證,但現在它已經足夠好了,因為我可以部署應用程序。

Hopefully this helps someone who is bashing their head against the wall.

希望這可以幫助那些正在抨擊牆壁的人。

I'll try and figure out if I can codesign both on one line somehow, but it's a minor posterity issue.

我會試着弄清楚我是否可以在一條線上以某種方式對兩者進行編碼,但這是一個次要的后代問題。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/09/07/7302210fff54aeb025fbffc9654715ec.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com