Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. {
  2. "meta": {
  3. "code": 200
  4. },
  5. "response": {
  6. "deals": [
  7. {
  8. "id": 32373,
  9. "date_added": "2011-01-13 12:12:50",
  10. "end_date": "2011-01-14 10:00:00",
  11.  
  12. "title": "$85 For $300 Babyface Facial At Park Avenue MedSpa",
  13. "yipit_title": "71% off Babyface Facial",
  14.  
  15. "tags": [
  16. {
  17. "name": "Facial",
  18. "slug": "facial",
  19. "url": "http://yipit.com/new-york/deals/facial/"
  20. },
  21. {
  22. "name": "Spa",
  23. "slug": "spa",
  24. "url": "http://yipit.com/new-york/deals/spa/"
  25. }
  26. ],
  27.  
  28. "source": {
  29. "name": "LivingSocial",
  30. "slug": "livingsocial",
  31. "paid": 0,
  32. "url": "http://yipit.com/new-york/livingsocial"
  33. }
  34. }
  35. ]
  36. }
  37.  
  38. NSURL *url= [NSURL URLWithString:@"...url ...."];
  39. NSURLRequest *request=[NSURLRequest requestWithURL:url];
  40. AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];
  41. operation.responseSerializer= [AFJSONResponseSerializer serializer];
  42. [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
  43. self.coursearray = [responseObject objectForKey:@"response"];
  44.  
  45. NSLog(@"The Array: %@",self.coursearray);
  46.  
  47. [self.tableView reloadData];
  48.  
  49. } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
  50. NSLog(@"Request Failed: %@, %@", error, error.userInfo);
  51.  
  52. }];
  53. [operation start];
  54.  
  55. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  56.  
  57. NSDictionary *tempdictionary=[self.coursearray objectAtIndex:indexPath.row];
  58.  
  59. cell.textLabel.text=[tempdictionary objectForKey:@"title"];
  60. return cell;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement