It is a little over 12 hours since we announced the new and Ruby gem, and now it is time for the next developer announcement, the availability of the  Mobile SDK developer preview. Currently, this developer preview supports iOS with support for other platforms in the near future.

In a nutshell, the SDK is comprised of two aspects:

1. Native Mobile libraries

The native mobile libraries provides OAuth 2  support for authenticating against and, as well as wrappers for calling the REST API.  Here is a quick example, you can check out the Github repository (Oh, it’s open source ) for more samples and documentation.

SFOAuthCredentials *credentials = [[[SFOAuthCredentials alloc] initWithIdentifier:remoteAccessConsumerKey] autorelease];
credentials.protocol = @"https";
credentials.domain = OAuthLoginDomain;
credentials.redirectUri = OAuthRedirectURI; 
self.coordinator = [[[SFOAuthCoordinator alloc] initWithCredentials:credentials] autorelease];
self.coordinator.delegate = self; 
[self.coordinator authenticate];

Now, we are  authenticated, let’s make a quick request for data using the requestForQuery method to return an NSMutableArray of data.

SFRestRequest *request;
request = [[SFRestAPI sharedInstance] requestForQuery:@"Select id, Name from Album__c"];
[[SFRestAPI sharedInstance] send:request delegate:self];

That’s all you need to get started. The native libraries handle all the rest. (no pun intended!)

2. Mobile Container

If you are a HTML5 developer and want the ability to securely access and, plus access local device functionality such as contacts, the Mobile SDK also provides the ability  to wrap a web app inside a thin native container, producing a hybrid application.

function onSalesforceOAuthLogin(event) {
logToConsole("onSalesforceOAuthLogin: Salesforce ready");
forcetkClient = new forcetk.Client(,;

Then, fetch some data, like this:

$('#link_fetch_sfdc_contacts').click(function() {
logToConsole("link_fetch_sfdc_contacts clicked");
forcetkClient.query("SELECT Name FROM Contact", onSuccessSfdc, onErrorSfdc);

If you are at Dreamforce, make sure you check out the Mobile App Dev area in the DevZone, and come and grab a Mobile workbook which will teach you how to build apps using the new SDK.

Houston, we are go for launch!






tagged , , , , Bookmark the permalink. Trackbacks are closed, but you can post a comment.
  • So I had a great time in the DevZone at #df11 maybe to much fun. There was so much going on I didn’t get time to checkout the Mobile SDK Workbook until I got home. The workbook was put together in a nice and simple way and I found it very useful. I did run into one issue at first but it didn’t take me long to remember my dev org had a namespace prefix set, so I had to account for that in the sample code. All in all, good work Salesforce Devers!

  • Fantastic. Love how the drums come in right as the iOS simulator comes up. #CrystalMethod

  • Joshua Ambrose

    Did any of you do insertion, deletion, or anything else in Hybrid Apps. I am using Phonegap with Salesforce Mobile SDK but can only retrieve the records. I just can not do anything else