2. Create forceios App

In this unit, you'll use forceios tool and generate a template native iOS App.

Step 1: Generate A React Native Sample App

In this step you'll use forceios tool to generate a sample React Native app that uses mobile SDK. In order to connect to Salesforce, we need to have a Salesforce Connected App with a new App ID and Callback URL. To simplify, forceios tool generates a template app that already uses a test app's "App ID" and "Callback URL"

  1. Open Terminal
  2. Type forceios create and hit enter to start generating the sample app.
  3. Type react_native for Enter your application type (native, nativeswift, reactnative, hybridremote, or hybridlocal): and hit Enter. This generates a sample app for type React Native iOS.
  4. Type ReactNativeSample for Enter your application name: and hit Enter.
  5. Hit Enter (leave the answer empty) for Enter the output directory for your app (defaults to the current directory):
  6. Type com.example.reactnativesample for Enter the package name for your app (com.mycompany.my_app):
  7. Type Example Inc for Enter your organization name (Acme, Inc.):
  8. Hit Enter(leave the answer blank) for Enter your Connected App ID (defaults to the sample app's ID):. The sample app will use the template app's own App ID. We can change this later
  9. Hit Enter(leave the answer blank) for Enter your Connected App Callback URI (defaults to the sample app's URI):. This will use the template app's own Callback URI. We can change this later as well.
  10. At this point, you should have a folder called ReactNativeSample

Note that this make take few minutes to download and install everything

Step 2: Install SDK dependencies

In this step you'll use Cocoapods tool to install Salesforce Mobile SDK's dependencies.

  1. In the terminal, CD into ReactNativeSample by running: cd ReactNativeSample
  2. Install dependencies by running: pod install
  3. If you do ls -al in the terminal, you should see ReactNativeSample.xcworkspace among other files.
  4. Open the app by running: open ReactNativeSample.xcworkspace. This opens the app in Xcode.

    Note: You should open ReactNativeSample.xcworkspace and NOT the ReactNativeSample.xcproject because the xcworkspace will now have the pod files.

index
  1. Setting Up Developer Environment
  2. Creating forceios App
  3. Running forceios App
  4. Adding Connected App
  5. Updating JavaScript
  6. Adding New React Native Component
  7. Workflow Summary
  8. Next Steps
comments powered by Disqus