Skip to main content

Set Up Your iOS Development Environment

What You’ll Learn

In this step, you’ll learn:
  • The software setup required for iOS development.
  • How to check for preinstalled software.
  • How to install missing software.

Prerequisites

  • A macOS X development machine.
  • Successful completion of step 1, Install Common Components.

About the iOS Development Environment

iOS development components include:

  • Xcode
  • iOS SDK

You install Xcode and the iOS SDK as a single unit from the Mac App Store. This package also installs the iOS simulator with recent iPhone and iPad images.

The minimum versions Mobile SDK 10.0 requires are:

  • Xcode 13
  • Deployment target: iOS 14 SDK
  • Base SDK: iOS 15 SDK
Note

If Windows is your development environment, skip this step—you can’t install Xcode. iOS development requires macOS. On Windows, you can use the Android platform to do Mobile SDK development.

Install Xcode and the iOS SDK

  1. On your Mac, open the App Store.
  2. Search the name Xcode.
  3. Click Get or Update, then, if prompted, click Install App.
  4. To install, verify, and confirm your installation, follow the prompts.
  5. When installation finishes, click Open.
  6. Accept the Xcode and iOS SDK license agreement.
  7. To install extra components for building and debugging, follow the prompts.

The Xcode package automatically installs simulator images for recent Apple mobile devices, so you don’t have to set them up.

Good job! Your development environment for Mobile SDK is ready for iOS native app development. If you’d like to install the optional-but-recommended Mobile SDK tool for creating native iOS apps, continue to install CocoaPods and forceios.

Install CocoaPods

CocoaPods is a third-party dependency manager required by forceios, a Mobile SDK utility. You need forceios and CocoaPods to earn the Develop with Mobile SDK badge. However, CocoaPods is optional for real-world Mobile SDK development.

To enable forceios, install CocoaPods.

  1. To check if it is already installed, type in the Terminal window: pod --version
    • If this command reports version number 1.8 or higher, you’re done—proceed to the next installation. If the reported version is below this range, continue to step 2.
    • If you get a “command not found” error message, continue to step 2.
  2. In the Terminal window, type:
    sudo gem install cocoapods -v 1.8
    If you encounter problems with this installation, consult the documentation at cocoapods.org.
  3. When the installer finishes, return to step 1.

Now that you’ve installed CocoaPods, you’re ready to install forceios.

Install Forceios

For creating compatible iOS apps, Mobile SDK provides forceios, an open-source command-line utility. Forceios is the quickest and easiest way to create native Mobile SDK apps for iOS. You enter some metadata as prompted, and a few minutes later you have a fully configured Xcode project.

Note

Forceios is required for the Develop with Mobile SDK badge, but it is optional for Mobile SDK iOS development. To create projects without it, see Creating an iOS Swift Project Manually.

To install forceios:

  1. Open the Terminal app.
  2. Type sudo npm install -g forceios and press Return.
  3. When prompted, enter your system password.
  4. To verify your installation, type forceios versionand press Return. For example:
    $ forceios version
    forceios version 10.0.0
  5. To view usage information for forceios, type forceios and press Return.

Good job! Now you can create a Mobile SDK app with forceios, load it into Xcode, and run it in an iOS simulator. You can continue to the Android installation step, if you haven’t done it already, or to the hybrid or React Native installation step.

We won’t check any of your setup. Click Verify Step to continue.

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈