Skip to content

Building Pass for iOS

Yishi Lin edited this page Feb 26, 2020 · 7 revisions

Basic Steps

  1. Install libtool, automake, cmake, carthage, and cocoapods: brew install libtool automake cmake carthage cocoapods
  2. Run carthage bootstrap in the project root directory: carthage update then carthage bootstrap --platform iOS (this may take some time)
  3. Run pod install in the project root directory: pod install
  4. Open .xcworkspace file in Xcode.
  5. Build & Run.

IMPORTANT NOTES

  • If you are using pod v1.5.3, you should be fine now.
  • Latest versions of pod seem to be buggy (e.g., CocoaPods/CocoaPods#8664). If your pod version is >=1.6.0 and your build is broken (e.g., crash immediately), you have to "manually add in the ObjectivePGP.framework into the target's General settings in Xcode and that would work" #247 (comment).

Run on real devices

If you want to run Pass for iOS on your real devices, here are a few more steps.

  1. Xcode project configuration

    • Select the pass project. Under the "Build Settings" tab, change the "Product Bundle Identifier" to com.yourdomain.passforios. The bundle identifier for all targets (e.g., pass, passExtension, passKit) will be update automatically. Make sure the bundle identifiers for all targets are changed.
    • Select the pass target. First, under the "General" tab, check "Automatically manage signing", and select your Team. Then, under the "Capabilities" tab, check your group under "App Groups", uncheck the original one.
    • Select the passExtension target. First, under the "General" tab, check "Automatically manage signing", and select your Team. Then, under the "Capabilities" tab, check your group under "App Groups", uncheck the original one.
  2. Modify the codes

    • Modify passKit/Helpers/Globals.swift, change the bundleIdentifier variable to com.yourdomain.passforios.

Or you can execute to replace all occurrences:

sed -i '' 's/me\.mssun\.passforios/youdomainname\.passforios/g' passExtension/passExtension.entitlements passAutoFillExtension/passAutoFillExtension.entitlements pass.xcodeproj/project.pbxproj passKit/Helpers/Globals.swift

Some issues you may experience when building from the scratch

  1. Swift version was too new? Update Xcode or solved with the little helper swiftenv, setting the swift version of this project to 4.1
  2. Don't forget to install dependencies using homebrew or macports.