Skip to content

Instantly share code, notes, and snippets.

@daichi1021
Created March 21, 2014 05:45
Show Gist options
  • Save daichi1021/9680246 to your computer and use it in GitHub Desktop.
Save daichi1021/9680246 to your computer and use it in GitHub Desktop.
- (void)pressSaveButton
{
NSDictionary *fields = @{@"Name": _nameField.text};
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForUpdateWithObjectType:@"Account"
objectId:_idData
fields:fields];
[[SFRestAPI sharedInstance] send:request delegate:self];
}
#pragma mark - SFRestAPIDelegate
- (void)request:(SFRestRequest *)request didLoadResponse:(id)jsonResponse
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
}
- (void)request:(SFRestRequest*)request didFailLoadWithError:(NSError*)error
{
//通信エラーが発生した場合の処理
if([error code] == -1009){
[self tempDataUpdate];
}
NSLog(@"request:didFailLoadWithError: %@", error);
}
- (void)tempDataUpdate
{
NSDictionary *updateobj = @{@"Name": _nameField.text, @"Id": _idData};
[[[SmartStoreInterface alloc] init] upsertAccount:updateobj];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment