Guest User

Untitled

a guest
Nov 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. NSString *urlString1 = [NSString stringWithFormat: @"%@/product/product_id",APIDomainURL];
  2. NSDictionary *jsonBodyDict = @{@"product_id":_productID,@"code":[[NSUserDefaults standardUserDefaults] stringForKey:@"selectedCountry"]};
  3. NSData *jsonBodyData = [NSJSONSerialization dataWithJSONObject:jsonBodyDict options:kNilOptions error:nil];
  4.  
  5.  
  6. NSMutableURLRequest *request = [NSMutableURLRequest new];
  7. request.HTTPMethod = @"POST";
  8. [request setURL:[NSURL URLWithString:urlString1]];
  9.  
  10. //NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:&error];
  11. if (jsonBodyData) {
  12. productHistoryAry = [NSJSONSerialization JSONObjectWithData:jsonBodyData options:kNilOptions error:&error];
  13. NSLog(@"Get value here:%@", productHistoryAry);
  14.  
  15. } else {
  16. NSLog(@"Unable to get %@: %@", jsonBodyDict, error);
  17. }
Add Comment
Please, Sign In to add comment