Skip to content

Build on MacOS with XCode for iOS

Marcus Hudritsch edited this page Jul 1, 2024 · 10 revisions

Requirements

  • An iPhone or an iPad
  • An Apple ID and a free developer account
  • Xcode
  • CMake ≥ 3.15 (Download)

Building and Running

  1. Clone the Git repository into a directory of your choice.
  2. Open Xcode.
  3. Add your Apple ID to Xcode if you haven't done that yet.
    1. Go to Xcode > Settings... > Accounts.
    2. Click the + button in the bottom-left corner, select Apple ID and click Continue.
    3. Log in with your Apple ID.
  4. Copy your development team ID.
    1. Open the app Keychain access.
    2. Go to login > Certificates.
    3. Double-click on your Apple developer certificate (e.g. Apple Development: [email protected] (123456)).
    4. In the popup window, copy (only) the ID in the line Organisational Unit. This is your development team ID.
  5. Open a terminal in the SLProject root directory and run the following commands (insert your development team ID at the placeholder):
    cd scripts
    ./generate_xcode_project_ios.sh <Your development team ID>
    
  6. In Xcode, open <SLProject root directory>/build_ios/SLProject.xcodeproj.
  7. In the top bar, select the scheme app-demo.
  8. Plug in your iPhone or iPad.
  9. In the top bar, select your connected device.
    • SLProject doesn't run on iOS simulators because we only provide library prebuilts for actual iOS devices.
  10. Click on the start button at the top to install and launch the app on your device.
  11. If you get a dialog saying "The request to open ch.bfh.ti.app-demo failed", tell your device to trust your development team.
    1. On your device, go to Settings > General > VPN & Device Management.
    2. Select Apple Development: <Your email address>.
    3. Click Trust "Apple Development: <Your email address>".
    4. Back in Xcode, try to launch the app again.

Building a Different App

  1. In the top bar, select the scheme for your app.
  2. Build and start again.