Salesforce Mobile SDK for iOS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore Mobile SDK for iOS

Developer Preview The code, sample applications, and documentation offered in this repository represent a preview of more full-fledged functionality to come. In the lead-up to a general release, the public APIs may change from their current representation and implementation details.


Native Mobile Libraries The Salesforce Mobile SDK provides essential libraries for quickly building native or hybrid mobile apps that seamlessly integrate with the Salesforce cloud architecture. Out of the box, we provide an implementation of the OAuth2 protocol, abstracting away the complexity of securely storing tokens or fetching refresh tokens when a session expires. The SDK also provides ObjectiveC REST API wrappers, making it easy to retrieve, store, and manipulate data.

Salesforce Mobile Container HTML5 is quickly emerging as dominant technology for developing cross-platform mobile applications. While developers can create sophisticated apps with HTML5 and JavaScript, some limitations remain, specifically: session management, access to the camera and address book, and the inability to distribute apps inside public App Stores. The Salesforce Mobile Container makes possible to combine the ease of web app development with power of the iOS platform by wrapping a web app inside a thin native container, producing a hybrid application.

Installation (Xcode 4 Project Template)

The easiest way to use the SalesforceSDK is to install the Xcode 4 project template:

cp -R native/\ Application.xctemplate ~/Library/Developer/Xcode/Templates/Project\ Templates/Application/

This allows you to create new projects of type Application directly from Xcode.

Using the SDK (in a project)

Create a new project. These 3 parameters are required:

  1. Consumer Public Key: The consumer key from your remote access provider.
  2. OAuth Redirect URL: The URL used by OAuth to handle the callback.
  3. Login URL: The login domain URL. Typically

After creating the project, you will need to:

  1. Open the Build Settings tab for the project.

    • Set Other Linker Flags to -ObjC -all_load
  2. Open the Build Phases tab for the project main target and link against the following required framework:

    • libxml2.dylib

You should then be able to compile and run the sample project. It's a simple project which logs you into a salesforce instance via oauth, issues a 'select Name from Account' query and displays the result in a UITableView.

Using the SDK (in an existing project)

You can also use the SDK in an existing project:

  1. Drag the folder native/dependencies into your project (check Create groups for any added folders)

  2. Open the Build Settings tab for the project.

    • Set Other Linker Flags to -ObjC -all_load.
  3. Open the Build Phases tab for the project main target and link against the following required frameworks:

    1. CFNetwork.framework
    2. CoreData.framework
    3. MobileCoreServices.framework
    4. SystemConfiguration.framework
    5. Security.framework
    6. libxml2.dylib
  4. Import the SalesforceSDK header via #import "SFRestAPI.h".

  5. Build the project to verify that the installation is successful.

  6. Refer to the SFRestAPI documentation for some sample code to login into a salesforce instance and issue a REST API call.

Working with the hybrid sample apps

The sample applications contained under the hybrid/ folder are designed around the PhoneGap SDK. Before you can work with those applications, you will need to download and install the 1.0.0 (or later) version of the PhoneGap SDK, which you can get from the PhoneGap website, linked above. You can find more detailed installation instructions, as well as documentation for working with the PhoneGap SDK, in the Getting Started Guide.

Note: The hybrid sample applications are configured to look for the PhoneGap iOS Framework in /Users/Shared/PhoneGap/Frameworks/PhoneGap.framework. If you installed or moved the PhoneGap framework elsewhere, or otherwise get compilation errors related to the PhoneGap Framework not being found (e.g. 'Undefined symbols for architecture i386: "_OBJC_METACLASS_$_PhoneGapDelegate"'), you will need to add the PhoneGap Framework to the sample project:

  1. Open the Xcode project of the sample application.
  2. In the Project Navigator, right-click or control-click the Frameworks folder, and select 'Add files to "Project Name..."'.
  3. Navigate to the Phonegap.framework folder (the default location is /Users/Shared/PhoneGap/Frameworks/PhoneGap.framework/), and click "Add".

The sample application project should now build and run cleanly.



If you would like to make suggestions, have questions, or encounter any issues, we'd love to hear from you. Post any feedback you have to the Mobile Community Discussion Board on