If you are working on a native iOS app that needs to interact with Salesforce data, the first step is to perform OAuth to authenticate the user. Salesforce provides native iOS SDK and forceios tool just for this purpose. However, depending on your app’s requirements you may need to choose one over the other. Secondly, if you are dealing with Salesforce Communities, you will need to do some extra configurations. This blog shows three such scenarios and explains how to configure Salesforce Native SDK for each one of them.
- Brand new iOS app – You are building a brand new iOS app and users can’t do anything unless they login to Salesforce.
- Existing iOS App – You already have an iOS app that might be authenticating with Heroku / Facebook, but now you want to add Salesforce authentication.
- Salesforce Communities or custom Facebook login – This could be brand new or existing app, but you want to users to use custom login page.
Brand New iOS App [~5 mins]
In this scenario, the recommended way to go is to use forceios tool. This tool automatically creates a sample iOS app that’s ready to go in 5 mins. The tool also imports all the libraries, dependencies, header search paths and linker flags. Perhaps the only caveat is that this app assumes that first view is Salesforce login page.
Existing iOS App [~10 mins]
In this scenario you already have an app and want to add Salesforce authentication to some part of your app. Check out the 10 mins video that shows how to manually add Salesforce SDK.
Salesforce Communities or Custom Facebook Login [~3 mins]
In this scenario you have a custom login page for your Salesforce community or portal users, and perhaps you have also configured ‘Facebook’ login to allow community members to login using Facebook. In this situation, you should first use one of the above two scenarios to add Salesforce authentication, and then you will configure it to use custom login page.
Bonus – iOS SDK Webinar [~1 hour]
This hour long webinar shows how to use forceios tool and also has our iOS SDK engineer demonstrate doing Salesforce CRUD operations.