I am using the latest Salesforce Mobile SDK to develop an iOS app to interact with CRM.
I have 2 SOQL queries to execute synchronously so that the data retrieved from first query can be used in the second query. The Salesforce Mobile 6.1 had an option something like:
let restApi = SFRestAPI.sharedInstance()
restApi.Promises.query(soql: "SELECT Id,FirstName,LastName FROM User")
.then { request in
restApi.Promises.send(request: request)
}
.done { sfRestResponse in
restResponse = sfRestResponse.asJsonDictionary()
...
}
.catch { error in
//handle error
}
But in the latest SDK the Promises have been deprecated. What is the better way to execute SOQL queries synchronously using the latest SalesForce Mobile SDK.
Version 6.2 of the Salesforce iOS SDK uses PromiseKit to synchronously chain asynchronous tasks (such as web requests). Even though it is not supported out-of-the-box in their 7.0 SDK, you can still import it for use in your project: PromiseKit
If you want to accomplish the same functionality natively using the new 7.0 SDK, the simplest way is to chain the callbacks: