Created
March 21, 2014 05:45
-
-
Save daichi1021/9680246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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