• J2theC
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 27
    Replies

Hey all, 

 

I'm still learning how to use the SalesForce Database service and the iOS SDK. I'm trying to get it to write a record into a table called "Audits". However, my request seems to keep failing as my console reads...

 

5/2/12 8:43:35.152 AM CloudTest2: request:didFailLoadWithError: Error Domain=com.salesforce.RestAPI.ErrorDomain Code=999 "The operation couldn’t be completed. (com.salesforce.RestAPI.ErrorDomain error 999.)" UserInfo=0x6b5a950 {message=The requested resource does not exist, errorCode=NOT_FOUND}

 

I must be doing something incorrectly. Here is the method I'm using...

 

 //Add a test record
    
    NSString * objectType = @"Audit";

    NSDictionary *fields = [@"{AuditName: Test, GroupID:1}" objectFromJSONString];
    SFRestRequest *TestAdd = [[SFRestAPI sharedInstance] requestForCreateWithObjectType:objectType fields:fields];
    
    [[SFRestAPI sharedInstance] send:TestAdd delegate:self];

 

 

What exactly am I doing wrong?

Hi, I am trying to get the Iphone simulator working and the documentation says you have to have hardware version 3.1.2

http://wiki.developerforce.com/page/Force.com_iPhone_Simulator

 

The only hardware versions I have availabe are 4.3.2 and 5.1

 

What do I need to download/install in order to have 3.1.2 available as a hardware version in the iOS Simulator?  I am using version 5.1 of the iOS Simulator.

 

I installed the simulator by installing XCode 4.3.1

 

I am pretty new to Macs so if I am misstating anything please let me know.

 

Thanks!

I am retreiving information from salesforce using the REST Bulk API to get CSV files with some data. The data I get from salesforce comes with some file characteristics that needs to be parsed. The only place I get information about the file format is on the bulk API's documentation, on the "Valid CSV Record Rows", that says the following: 

 

• The delimiter for field values in a row must be a comma.

• If a field value contains a comma, a new line, or a double quote, the field value must be contained within double quotes: for example, "Director of Operations, Western Region".

• If a field value contains a double quote, the double quote must be escaped by preceding it with another double quote: for example, "This is the ""gold"" standard".

• Field values aren't trimmed. A space before or after a delimiting comma is included in the field value. A space before or after a double quote generates an error for the row. For example, John,Smith is valid; John, Smith is valid, but the second value is " Smith"; ."John", "Smith" is not valid.

• Empty field values are ignored when you update records. To set a field value to null, use a field value of #N/A. Name,Mother_Of_Child__r.External_ID__c CustomObject1,123456 Subject,Priority,Status,Lead:Who.Email,Owner.Id Test Bulk API polymorphic reference field,Normal,Not Started,lead@salesforcesample.com,005D0000001AXYz 18
Preparing Data Files Sample CSV File

• Fields with a double data type can include fractional values. Values can be stored in scientific notation if the number is large enough (or, for negative numbers, small enough), as indicated by the W3C XML Schema Part 2: Datatypes Second Edition specification.

 

 

Now, this is specific to generating CSV files, is there such thing as a documentation with details about all the possible formats the file can follow? 

I am using the mobile SDK for iOS and i am trying to get some information from objects, such as Account, Contact, Task, etc. When downloading records for accounts, I can get a maximun of 2000 records, and i can continue to get more records using the next request URL, however when trying to get records for accounts and other related lists, i only get 1000 records at a time, while still getting the next request URL. Why is there a difference with this? 

 

 

I am using the iOS native mobile SDK. My query is not limiting the number of requests

  • March 09, 2012
  • Like
  • 0

I was working with the Salesforce SDK and was trying to test the response of my application when salesforce replies with an inactive_user error. I was expecting to receive an error with the code kSFOAuthErrorInactiveUser. Instead, This is what i received: 

 

Error Domain=com.salesforce.OAuth.ErrorDomain Code=666 "com.salesforce.OAuth.ErrorDomain LOGIN_ERROR_USER_INACTIVE : LOGIN_ERROR_USER_INACTIVE" UserInfo=0x6ca970 {error_description=LOGIN_ERROR_USER_INACTIVE, NSLocalizedDescription=com.salesforce.OAuth.ErrorDomain LOGIN_ERROR_USER_INACTIVE : LOGIN_ERROR_USER_INACTIVE, error=LOGIN_ERROR_USER_INACTIVE}

 

 

while the error itself is self-explinatory, it's not available on the salesforce documentation for ExceptionCod/StatusCode, and the error code i received is kSFOAuthErrorUnknown, which leads me to beleive that something might not be working correctly here. is there something i am missing here?

 

 

I am using the salesforce SDK building a native application.

  • March 09, 2012
  • Like
  • 0

I just updated to the latest version of the salesforce sdk framework and i am getting a different value in the properties of the SFOauthCredentials object. I was expecting the userId of the user, but instead I am getting null values. Here's the printout of the credentials object: 

 

po [[[SFRestAPI sharedInstance] coordinator] credentials]

<SFOAuthCredentials identifier="(identifier value)" clientId="(client id value)" domain="test.salesforce.com/" identityUrl="(null)" instanceUrl="(null)" issuedAt="(null)" organizationId="(null)" protocol="https" redirectUri="sfdc://success">

 

 

any ideas?

  • February 02, 2012
  • Like
  • 0

I want to use salesforce mobile SDK into existing project. How to use the oauth2  mobile SDK in existing project. I tried to use the SFCoodinator Class (ios) in my project i was put the login Webview generated by the oauth library in my viewcontroller, i was to login and i get a screen which ask permission to access the data when i press allow i go white sceen and my SFCoordinatorDelegate didAuthenticate method is not called 

Hi everyone,

 

Is there an API for the standard objects? I looked through the Salesforce Mobile SDK and I can't seem to find them.

 

(By API I mean Java classes/objects that encapsulate the Salesforce standard objects.)

 

Thanks in advance!

 

 

Cheers,
Zarah. 

Hi,

 

I have created new custom button into lead page layout which works in the browser but does not appear on the Iphone app. 

 

Any help is much appreciated.

 

Thanks!!

  • May 21, 2012
  • Like
  • 0

Hi,

 

I need to retrieve only deleted records from Contacts using ios to synchronize data with my ipad application. I am trying a query which I check isDeleted = true, but it doesn't work. In java api, we have a getDeleted() method to simplify our life. Someone know, what is an equivalent method or something that works fine?

 

Thanks,

brum

  • May 16, 2012
  • Like
  • 0

I am new in Salesforce and ios development. I need to download a text file and images from Salesforce (Files or Libraries) and save it on disk using ios and rest api. I am trying this code below, but it doesn't work or not complete. Please, someone help me to know :

1) What is the correct url?

2) What is object id length : 15 or 18?

3) How to get OAuth token and Authorization? I have my consumer key, login domain,...

4) The complete code like methods to handle the response, error, ...

 

    NSURL *myURL = [NSURL URLWithString:@"https://test.salesforce.com/v23.0/sobjects/ContentVersion/<objectID>/VersionData"];
    NSMutableURLRequest* requestDoc = [[NSMutableURLRequest alloc] initWithURL:myURL];
    [requestDoc addValue:@"OAuth token" forHTTPHeaderField:@"Authorization"];
    [NSURLConnection connectionWithRequest:requestDoc delegate:self];

 

Thanks,

brum

  • May 16, 2012
  • Like
  • 0

I am working on an iOS app procedure that queries a SQLite database and attempts to upload the records onto SalesForce. However, I seem to be having issues with the date fields. I keep getting an error message that it cannot be serialized. My JSON-savvy coworker suggested I try using the ASCII notation to represent the "/" in the dates, but it still keeps giving me the same error. How do I format the StartDate field so SalesForce will accept it?

 

 if (sqlite3_prepare_v2(database, [query UTF8String],-1,&statement, nil) ==SQLITE_OK)
    {
        while (sqlite3_step(statement) == SQLITE_ROW)
        {
           

NSDate* MyDate = [formatter dateFromString: [NSString stringWithCString (char*)sqlite3_column_text(statement, 2) encoding:NSUTF8StringEncoding]];

NSMutableString * StartDate = [NSMutableString stringWithFormat:@"%@",[formatter stringFromDate:MyDate]];

 [StartDate replaceCharactersInRange: [StartDate rangeOfString:@"/"] withString:@"&#48" ];

 [StartDate replaceCharactersInRange: [StartDate rangeOfString:@"/"] withString:@"&#48" ]; //Other fields, irrelevant code to problem
NSDictionary * fields = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects: [NSNumber numberWithInt:FormID],AuditID,StartDate,StartTime,StationID,UserID,Gate,FlightNumber,RegNoseNumber,Completed,Year,AirCraft, nil] forKeys:[NSArray arrayWithObjects: @"FormID__c",@"AuditID__c",@"StartedDate__c",@"StartedTime__c",@"StationID__c",@"UserID__c",@"Gate__c",@"FlightNumber__c",@"RegistryNoseNumber__c",@"Completed__c",@"Year__c",@"Aircraft__c", nil] ]; SFRestRequest *request = [[SFRestAPI sharedInstance] requestForCreateWithObjectType:@"Form__c" fields:fields]; [[SFRestAPI sharedInstance] send:request delegate:self]; } sqlite3_finalize(statement); sqlite3_close(database);

 

Hello All

 

I have been developing a Native Mobile App for the iPhone and iPad App.

 

The App is developed in Objective-C with a SQLite database on the device and a mySQL database on a server.

 

And then I discovered Developer Force.

 

I would obviously like to use the features of Developer Fore to ensure a robust and sclable solution, for example :

 

* Registration

* Security

* Login

* Infrastructure

 

But I am confused, would I need to re-code my App for Developer Force ?  Or am I able to re-use my current code within Developer Force ?

 

In particular, does Developer Force support sqLite and mySQL ?

 

Thank you, in advance.

 

Regards

 

 

  • May 11, 2012
  • Like
  • 0

Hey all, 

 

I'm still learning how to use the SalesForce Database service and the iOS SDK. I'm trying to get it to write a record into a table called "Audits". However, my request seems to keep failing as my console reads...

 

5/2/12 8:43:35.152 AM CloudTest2: request:didFailLoadWithError: Error Domain=com.salesforce.RestAPI.ErrorDomain Code=999 "The operation couldn’t be completed. (com.salesforce.RestAPI.ErrorDomain error 999.)" UserInfo=0x6b5a950 {message=The requested resource does not exist, errorCode=NOT_FOUND}

 

I must be doing something incorrectly. Here is the method I'm using...

 

 //Add a test record
    
    NSString * objectType = @"Audit";

    NSDictionary *fields = [@"{AuditName: Test, GroupID:1}" objectFromJSONString];
    SFRestRequest *TestAdd = [[SFRestAPI sharedInstance] requestForCreateWithObjectType:objectType fields:fields];
    
    [[SFRestAPI sharedInstance] send:TestAdd delegate:self];

 

 

What exactly am I doing wrong?

I am converting the Mobile SDK template project to ARC but it is not working. How does one use the Mobile SDK with automatic reference counting?

 

Thanks,

tirat

  • April 23, 2012
  • Like
  • 0

Hi,

 

I have a requirement to download many (10,000s) of records from force.com to the device (iPhone), and it looks like bulk query API is the way to go.

 

I'd appreciate it if someone could confirm this is accessible in some way by the current iOS Salesforce SDK?

 

If so, would this be via a RESTful access?

 

Thanks,

Nige

  • April 12, 2012
  • Like
  • 0

Hello!!!

i am trying to put a new account in sales force . but the query is not working fine:'

i am trying to extract id from the acconts table of sales force:

 

SFRestRequest *request = [[SFRestAPI sharedInstancerequestForQuery:@"SELECT AccountId FROM Account LIMIT 5"];    

        [[SFRestAPI sharedInstancesend:request delegate:self];

 

  • April 12, 2012
  • Like
  • 0

Hi there i was wondering in iOS on how can i open in a WebView a Salesforce page (Accounts page for example) once i've got the OAuth in my application.  How can i use the user credentials to do this?

 

thanks

  • March 29, 2012
  • Like
  • 0

I'm working on an iPhone application using SalesForce, and I was wondering if there was a way to programatically login to sales force, so that the users of my application don't have to see the screen pictured below.. thoughts?

 

I'm very new to sales force and I find it all a bit overwhelming.

 

 

Login screen

  • March 23, 2012
  • Like
  • 0

I'm relatively new to both iOS and OAuth, but I've combed through the available documentation to try to figure this out, and I still can't get it to work properly.  I'm using the SalesforceMobileSDK-iOS.  When I create a new Mobile-SDK-based-application using the provided project template, the default login implementation is:

 

- (void)login {

SFOAuthCredentials *credentials = [[[SFOAuthCredentialsalloc] initWithIdentifier:remoteAccessConsumerKey] autorelease];

credentials.protocol = @"https";

credentials.domain = OAuthLoginDomain;

credentials.redirectUri = OAuthRedirectURI;

 

self.coordinator = [[[SFOAuthCoordinator alloc] initWithCredentials:credentials] autorelease];

self.coordinator.delegate = self;

                

// remove this line if we want to cache the key, and use refresh flow

//effectively, we are saying, purge the old login and re-authenticate each time

[self.coordinator revokeAuthentication];

 

//now let's authenticate

[self.coordinatorauthenticate];

}

 

My interest is in this line:

 

// remove this line if we want to cache the key, and use refresh flow

//effectively, we are saying, purge the old login and re-authenticate each time

[self.coordinator revokeAuthentication];

 

I _do_ want to cache the key and use the refresh flow so that my user isn't forced to re-login every time they bring up the app.  However, when I remove this line, I'm still prompted for a login each time I bring up the app (even if I switch away from it and come right back).

 

I've also tried caching the refreshToken in "oauthCoordinatorDidAuthenticate":

 

- (void)oauthCoordinatorDidAuthenticate:(SFOAuthCoordinator *)coordinator {

    [self.window.rootViewController.viewremoveFromSuperview];

    

    NSUserDefaults *defaults = [ NSUserDefaultsstandardUserDefaults ];

    // Save the access token in the preferens and try to use it to refresh the token on next launch rather

    // than display a login screen.

    [ defaults setObject:coordinator.credentials.refreshToken forKey:@"refreshToken" ];

 ...

 

and setting the same refreshToken in "applicationDidBecomeActive":

 

- (void)applicationDidBecomeActive:(UIApplication *)application

{

    NSUserDefaults *defaults = [ NSUserDefaultsstandardUserDefaults ];

    

    SFOAuthCredentials *credentials = [[[SFOAuthCredentialsalloc] initWithIdentifier:remoteAccessConsumerKey] autorelease];

    credentials.protocol = @"https";

    credentials.domain = OAuthLoginDomain;

    credentials.redirectUri = OAuthRedirectURI;

    

    //now let's authenticate

    NSString *refreshToken = [ defaults stringForKey:@"refreshToken" ];

    

    if ( refreshToken != nil )

    {

        credentials.refreshToken = refreshToken;

        self.coordinator = [[[SFOAuthCoordinator alloc] initWithCredentials:credentials] autorelease];

        self.coordinator.delegate = self;

        [ self.coordinatorauthenticate ]; // this should NOT pop up a new window, since the credentials are stored

 

Looking over the source code of SFOAuthCoordinator, this seems to be how it's supposed to work, but this just crashes my app (I'm still trying to figure out why - XCode isn't very good about telling you where your app crashed or why).

 

Has anybody been able to get this refresh flow working with the iOS Mobile SDK?  I'd have to imagine this is a pretty common setup.