Search code examples
restsoapios6salesforcexcode4.5

How to get a Salesforce soap session id in iOS


I need to connect to either Salesforce.com or Database.com (same concept) from an iOS application. I don't care if it's soap or rest. All I want to do is get the data out. I am using an administrator login to query against custom objects and return records.

I am not sure the mobile sdk provided by Salesforce is the best option. From my tests and sample applications it requires oAuth. I'm not an expert with oAuth on iOS, but my understanding is the user will have to authenticate to use the app. I want Salesforce or Database.com to be queried using the credentials I supply, not prompt the user to login.

If possible, I would like to use as much standard functionality as possible. If this can be done without installing additional libraries that would be perfect. If that is not possible, I am willing to try anything at this point.

I have searched for hours and tried 5-7 different approaches. I'm confident it's not nearly as challenging as it appears.

Any help is greatly appreciated.


Solution

  • zkSforce is an objective-c library usable from iOS that can call the salesforce.com soap api including login. Also there's a username/password flow for OAuth2 which allows for programatic rather than interactive logins, this is a simple HTTP POST

    For either the soap login or the OAuth username/password flow, the API security token may be needed in addition to the password depending on the IP address that the login originates from and the configured networks in salesforce.