• RacerRex9727
  • NEWBIE
  • 5 Points
  • Member since 2012

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

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

 

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

 

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