function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Craig IsaksonCraig Isakson 

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:
 
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.
Best Answer chosen by Craig Isakson
Philip GuerreiroPhilip Guerreiro

Managed to resolve after looking into the issue i was missing #import "SFRestAPISalesforceAction.h" as the framework has changed

All Answers

Philip GuerreiroPhilip Guerreiro
I'm also having the same issue need some help with this
Philip GuerreiroPhilip Guerreiro

Managed to resolve after looking into the issue i was missing #import "SFRestAPISalesforceAction.h" as the framework has changed
This was selected as the best answer
Craig IsaksonCraig Isakson
Hi Phillip,

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 :)