Skip to content

Instantly share code, notes, and snippets.

@ppworks
Created July 10, 2012 11:15
Show Gist options
  • Save ppworks/3082720 to your computer and use it in GitHub Desktop.
Save ppworks/3082720 to your computer and use it in GitHub Desktop.
まじで断片ですまぬ
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
if (self.item_page == 1 && !JSON) {
[UIUtilitiy hideActivityIndicator];
[UIUtilitiy showAlert:@"error" text:@"見つかりませんでした"];
return;
}
if (JSON) {
[self.items addObjectsFromArray:[[[NSMutableArray alloc]initWithArray:JSON]autorelease]];
self.not_found = NO;
} else {
self.not_found = YES;
}
[self.tableView reloadData];
[UIUtilitiy hideActivityIndicator];
} failure:nil];
[operation start];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment