Skip to content

iOS development hints&tips

Wiktor Sieprawski edited this page Feb 9, 2023 · 8 revisions

Using notarytool for submission to the App Store Connect (CI case)

If notarization succeeds, notarytool prints a submission identifier:

Successfully uploaded file
  id: 6ca8b1b0-637c-455a-a9ef-80336a343ce1

Save the id value to use later when checking the status of your request. After you upload your app, the notarization process typically takes less than an hour.

To download a log file that contains any errors or warnings that occurred during notarization, use notarytool with the log command.
The log command downloads JSON-formatted data and saves it to the specified file.

xcrun notarytool log 6ca8b1b0-637c-455a-a9ef-80336a343ce1 --team-id CTYKSWN9T4 --apple-id $APPLE_ID --password $APP_SPECIFIC_PASSWORD notarytool_log.json

See https://support.apple.com/en-us/HT204397 to learn how to generate app specific password.

Updating provisioning profile in GitHub actions

Get the provisioning profile from App Store Connect, then encrypt it with gpg (do not use public-key cryptography).

gpg --output CI.mobileprovision.gpg --symmetric CI.mobileprovision

Type in secure passphrase and set it to $IOS_PROFILE_KEY in repository's secrets. The last step is to replace old .gpg file with the new one under .github/secrets

Exporting deployment Certificate

Follow the instructions on
https://support.magplus.com/hc/en-us/articles/203808748-iOS-Creating-a-Distribution-Certificate-and-p12-File

Running without build

Really handy thing is to run an app without re-building it first.
Simply use command + control + R, or go Product -> Perform action -> Run without build.

Sometimes you may want to edit files directly in build folder to immediately see the result, without having to wait for a build to finish. You can locate them at /Users/apple/Library/Developer/Xcode/DerivedData/Quiet-BUILD_HASH/Build/Products/Debug-iphoneos/Quiet.app.

Building .framework

Create a new Xcode project choosing "framework" type. Then to build a .framework, run following commands

xcodebuild archive \                                                     
  -project FRAMEWORK_NAME.xcodeproj \
  -scheme FRAMEWORK_NAME \
  -destination generic/platform=iOS \
  -archivePath "archives/FRAMEWORK_NAME" \
  SKIP_INSTALL=NO \

then

cp -r archives/FRAMEWORK_NAME.xcarchive/Products/Library/Frameworks/. archives/ios