Force.com Contact Apex HTML5 Iphone App

This is part 2 of the tutorial so make sure you have completed Part 1:

https://thysmichels.com/2012/02/07/force-com-contact-apex-html5-tutorial/

We will now create a Hybrid Iphone App.

Step 1. Create a new remote access setting by navigating to Setup-> Developer -> Remote Access. Create a remote access by specifying a callback URL:

sfdc://success

Note: Remember the newly created consumer key cause you will use it the bootstrap.js file.

Step 2. Download and Install the Salesforce iOS SDK

Download:

https://github.com/forcedotcom/SalesforceMobileSDK-iOS.

Install:

./install.sh

Step 3. Open XCode and create a new Force.com Hybrid App

Step 4. Delete the www folder and replace with file attached. Replace with the new www file which you can download from:

https://github.com/forcedotcom/SalesforceMobileSDK-Samples

Step 5. Navigate to the bootstrap.js file and edit the following settings

var debugMode = true;

// The client ID value specified for your remote access object that defines
// your application in Salesforce.
var remoteAccessConsumerKey = "###";

// The redirect URI value specified for your remote access object that defines
// your application in Salesforce.
var oauthRedirectURI = "sfdc://success";

// The authorization/access scope(s) you wish to define for your application.
var oauthScopes = ["visualforce","api"];

// The start page of the application.  This is the [pagePath] portion of
// http://[host]/[pagePath].  Leave blank to use the local index.html page.
var startPage = "apex/SalesKing";  // Used for local REST-based"index.html" PhoneGap app.
//var startPage = "apex/BasicVFPage"; //used for Visualforce-based apps

// Whether the container app should automatically refresh our oauth session on app foreground:
// generally a good idea.
var autoRefreshOnForeground = true;

Step 6: Run your application. It will prompt you to login to Salesforce using your Salesforce username and password.

Step 7. It will ask to allow or deny access to the application you specified in step 1. Click ‘Allow’ to access the application.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: