Guest User

Untitled

a guest
Jan 21st, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. -(void)registerDevice{
  2.  
  3. // get mac address
  4. NSString *macAddress = [self getMacAddress];
  5. NSLog(@"MAC ADDRESS RETURNED: %@", macAddress);
  6.  
  7.  
  8. NSString *command= @"BookAbort";
  9. NSString *format=@"JSON";
  10.  
  11.  
  12. //[SVProgressHUD showInView:self.view];
  13.  
  14. // prepare MAC address
  15. // NSString *processedMACAddress = [macAddress
  16. // stringByReplacingOccurrencesOfString:@":" withString:@""];
  17.  
  18. macAddress = @"1234";
  19.  
  20. NSString * url = [NSString stringWithFormat:@"registerDevice/%@.htm", macAddress];
  21.  
  22. NSLog(@"Connecting URL : %@", url);
  23.  
  24. NSArray *keys = [[[NSArray alloc] initWithObjects:@"deciveID",nil] autorelease];
  25.  
  26.  
  27. NSArray *values = [[[NSArray alloc] initWithObjects:@"1234",nil] autorelease];
  28.  
  29. NSDictionary *requestParameters = [[[NSDictionary alloc] initWithObjects:values forKeys:keys] autorelease];
  30.  
  31.  
  32. [[FMBHTTPClient sharedClient] postPath:url parameters:requestParameters success:^(id object) {
  33.  
  34. [SVProgressHUD dismiss];
  35.  
  36. NSLog(@"Server response Book abort%@ ", object);
  37.  
  38.  
  39. } failure:^(NSHTTPURLResponse *response, NSError *error) {
  40.  
  41. [SVProgressHUD dismissWithError:[error localizedDescription]];
  42.  
  43. NSLog(@"Error : %@", error);
  44.  
  45. }];
  46.  
  47.  
  48. }
  49.  
  50. 2012-09-24 17:50:36.669 FMB[7538:207] Error :Error Domain=com.alamofire.networking.error Code=-1011 "Expected status code <NSIndexSet: 0x6826a40>[number of indexes: 100 (in 1 ranges), indexes: (200-299)], got 405" UserInfo=0x6a43410 {NSErrorFailingURLKey=<URL PATH>, NSLocalizedDescription=Expected status code <NSIndexSet: 0x6826a40>[number of indexes: 100 (in 1 ranges), indexes: (200-299)], got 405}
Add Comment
Please, Sign In to add comment