You need to sign in to do that
Don't have an account?

Issue with native iOS Swift class using SFRestAPI.send
Hello,
I am developing a native iOS app on the Salesforce 1 platform. I used forceios to create the barebones sample app. I created a Swift class that is an extension of NSObject as well as SFRestDelegate. I am able to create a an instance of SFRestAPI from the shared instance but am unable to call the .send function. I get the error 'SFRestAPI' does not have a member named 'send'. I went to the SFRestAPI header and I see the .send methods but for some reason cannot reach them from my Swift class. I can call them fine from Objective C though. Here is a sample of the code:
I have the briding header that is required for linking but just the .send function is giving me errors:
Any help that could be provided would be greatly appreciated.
I am developing a native iOS app on the Salesforce 1 platform. I used forceios to create the barebones sample app. I created a Swift class that is an extension of NSObject as well as SFRestDelegate. I am able to create a an instance of SFRestAPI from the shared instance but am unable to call the .send function. I get the error 'SFRestAPI' does not have a member named 'send'. I went to the SFRestAPI header and I see the .send methods but for some reason cannot reach them from my Swift class. I can call them fine from Objective C though. Here is a sample of the code:
import Foundation= class MyHandler: NSObject, SFRestDelegate { func getData() { var sharedInstance = SFRestAPI.sharedInstance() var request = sharedInstance.requestForQuery("SELECT Id FROM Account LIMIT 10") sharedInstance.send(request as SFRestRequest, delegate: self) } //delegate methods...
I have the briding header that is required for linking but just the .send function is giving me errors:
#import <UIKit/UIKit.h> #import "SFRestAPI.h" #import "SFRestRequest.h"
Any help that could be provided would be greatly appreciated.
Managed to resolve after looking into the issue i was missing #import "SFRestAPISalesforceAction.h" as the framework has changed
All Answers
Managed to resolve after looking into the issue i was missing #import "SFRestAPISalesforceAction.h" as the framework has changed
I was able to resolve. You are correct. Just had to add #import <SalesforceRestAPI/SFRestAPISalesforceAction.h> to the briding-header. I forgot I still had this question out there :)