Use xcodebuild to archive and export app

I wrote an article beforemacOS app script to automate notarize,But there is no mention of using code to automatically compile and generate App scripts,After all, there are many tools to complete this step,For example, fastlane。

I didn’t think about automation before notarize,At the time of writing that article, fastlane did not support notarized upload,So I wrote it myself,The specific compilation command is like this:

In this way, the dsym and app files can be directly generated,Very convenient。

...But the good times don't last long,Apple seems to have changed the notarized server behavior recently,The sparkle integration signature problem that has been a headache before reappears,In short, every time you use the app generated by the script,There are always various problems with the signature of sparkle,And local detection is normal。

As a comparison,Generate and upload using Xcode's own archive,Everything is normal (I separately made additional signature code for Sparkle,It works,But compiling with commands will not work)。

I guess it may be that the app is directly generated and lost some cache,After query,Now divided into two steps,Generate a normal archive first ,Then export the app from the archive。

Generate xcarchive ,There is nothing to say in this step,You can succeed directly,The next steps are a bit more complicated:

Select the xcarchive you just generated,Then export the app from inside (and sign),This step requires a strange -exportOptionsPlist ,And currently there is no complete template on the Internet,In general, this configuration file does not need to be filled with all parameters,Just write the main parameters,Other parameters can be as default,The previous Xcode version can also export a configuration file from the archive function (this file also has a copy when exporting),Seems to be unable now,In short,I give a template,You can refer to write,Anyway, if you make a mistake,It will report an error,Then tell you what parameters are missing,Or which one is wrong,Which one should be,Very easy to troubleshoot:

Such as above teamID and signingStyle Field,Actually can be omitted,because xcodebuild Will automatically read from your project configuration。


Now the exported app can be notarized normally。

Original article written by Gerber drop-off:R0uter's Blog » Use xcodebuild to archive and export app

Reproduced Please keep the source and description link:https://www.logcg.com/archives/3385.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Comments

  1. Hi, first off – many thanks for your blog, it got me started. However the part of xcodebuild -exportArchive doesn’t work for me, especially those -exportOptionsPlist entries that I just CANT get right. xcodebuild keeps emitting nonsense errors and refuses to export my archive – and although the plist entries are kind-of documented in xcodebuild -help | grep exportOptionsPlist — I still can’t get it right. If you managed to make it work, I’d like to contact you for few questions.

Leave a Reply

Your email address will not be published. Required fields are marked *