Skip to content

Instantly share code, notes, and snippets.

@sstadelman
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save sstadelman/c4cf362f0d63710fc14a to your computer and use it in GitHub Desktop.

Select an option

Save sstadelman/c4cf362f0d63710fc14a to your computer and use it in GitHub Desktop.
Tracking unique id's
@interface MyViewController ()
@property (nonatomic, strong) NSString *accountRequestId;
@property (nonatomic, strong) NSString *opportunityRequestId;
//or
@property (nonatomic, strong) NSMutableArray *accountRequests;
@end
@implementation MyViewController
- (void) loadModel
{
id<SODataRequestExecution> requestExecution = [myStore scheduleReadEntitySet:@"Accounts" delegate:self options:nil];
self.accountRequestId = requestExecution.uniqueId;
//or
[self.accountRequests addObject:requestExecution.uniqueId];
}
- (void) requestServerResponse:(id<SODataRequestExecution>)requestExecution
{
if ([requestExecution.uniqueId isEqualToString:self.accountRequestId]) {
// update the Accounts model
} else {}
// or
if ([self.accountRequests containsObject:requestExecution.uniqueId]) {
// update the Accounts model
[self.accountRequests removeObject:requestExecution.uniqueId];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment