Build iOS application and upload to App Store from command line

Currently I am investigate how to build the iOS application from command line, this article is what I have done right now.

Build iOS application and upload to App Store from command line

Currently I am investigate how to build the iOS application from command line, this article is what I have done right now.

Build application and generate xcarchive filexcodebuild -workspace <project>.xcworkspace \
   -scheme <schema name> \
   -configuration 'Release' \
   -sdk iphoneos \
   archive -archivePath ${PWD}/build/<project>.xcarchive

Replace the project name and schema name with your project information, my project works with cocoapods, so I build the project with the xcworkspace, the generated xcarchive will be located under build directory.

Upload application to App Storexcodebuild -exportArchive \
   -archivePath ${PWD}/build/<project>.xcarchive \
   -exportOptionsPlist exportOption.plist \
   -exportPath ${PWD}/build

The command above can export ipa file or upload the application to the App Store, it depends on the content of the exportOption.plist file.

Upload to App Store

The content below is the content of the exportOptions.plist , with this options, the xcodebuild command will upload the application to the App Store.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>method</key>
   <string>app-store</string>
   <key>destination</key>
   <string>upload</string>
</dict>
</plist>

Export to ipa file

The content below of the file exportOptions.plist will export the archive to an ipa file, just change the destination to export.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>method</key>
   <string>app-store</string>
   <key>destination</key>
   <string>export</string>
</dict>
</plist>

The problem that still exists

When I run exportArchive command, it will ask me to input the password to get the information from keychain, I select ‘Always Allow’, and it reports the following error:IDEDistribution: Failed to log in with account "<apple id>" while checking for an App Store Connect account
error: exportArchive: Failed to log in.

I delete the account from xcode and login again, and input the password every time, it can upload successfully, I still need to investigate the problem again.

Read more

AI读经 - 马太福音 第7章

AI读经 - 马太福音 第7章

这段经文出自《马太福音》第7章,是耶稣“登山宝训”的总结部分,主题集中在信徒的内在生命与外在行为。主要内容包括不论断他人(1-5节)、寻求神的帮助(7-12节)、选择生命的道路(13-14节)、提防假先知(15-20节)、真信徒的生命表征(21-23节)、以及听道与行道的重要性(24-27节)。这些教导旨在呼召信徒过敬虔和真实的生活,表现出神国的公义与恩典。

By Stephen Li