• Craig Isakson
  • NEWBIE
  • 9 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
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.
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.
I followed all the instructions on the Getting Started with Hybrid Development module (https://developer.salesforce.com/trailhead/mobile_sdk_intro/mobile_sdk_hybrid/mobilesdk_hybrid_getting_started)

When I put in the command - "cordova emulate android", when it tried to run the app, I got an error "net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html)

Any thoughts?
 

I've spent way too many long nights on this.  My app is 95% done except I need this last little bit to work.

 

What I think I've learned:

 

- latest version doesn't use SFNativeRestAppDelegate.*m* - which means all of the answers I found via Google (like this: http://www.sundoginteractive.com/sunblog/posts/ios-salesforce-sdk-tips ) on how to get the current userId in a separate class/View doesn't work.

 

I've tried declaring a new instance of SFOAuthCredentials and of SFIdentityData (which I think is the correct one of the two):

 

    SFOAuthCredentials *class7Instance = [[SFOAuthCredentials alloc] init];
    NSString *stringValue7 = class7Instance.userId;

 

 

 

I'm not an iOS developer by trade but I've got my app all working except I need to extract the userId to take some additional logic (code already written).

 

Can someone help?  I'm interested in using the latest version, not ZKSForce or an older version of the SFDC Mobile SDK unless I really really have to.

 

I think it's something pretty simple.

 

When I've tried declaring an instance or setting NSUserDefaults, in debugger the string values are always 00000.

Is it possible to do any reflective calls on custom classes?

 

I have something like

 

public class CustomTaskObject { public Boolean isSelected {get;set;} public String Id {get;set;} public String Subject {get;set;} public String AccountName {get;set;} public WhatName {get;set;} public WhatStatus {get;set} public Double Timezone {get;set} ... }

 

Basically I populate a list of this CustomTaskObject, and do a very special sort done by Timezone (10 hours ahead of the current user's Timezone, desc), and then by "WhatStatus" priority (which is all done in code as there is no way to do this in SOQL) and throw it into a VisualForce pageBlockTable.

 

Users want to have the functionality to sort by other columns, such as AccountName, or WhatStatus, and I would like to have a way to make it so that I can call

 

object.getField('WhatStatus')

 

to simplify the sorting routine. Otherwise I would have to write a sort procedure to handle each field that is available for sorting.

 

Is reflection possible?

 

I have seen in other threads where people are dealing with sObjects which do have reflection, but I'm guessing that this is not possible with custom classes?

 

Thanks!

  • March 10, 2010
  • Like
  • 0