У меня действительно странный ответ на MSMutableURLRequest:
Error Domain=NSURLErrorDomain Code=-1000 "bad URL"
URL составлен таким образом. Да, я знаю, что выкладываю токен моего тестового устройства онлайн. Я изменил цифру для конфиденциальности.
self.pushTokenData = deviceToken;
NSURL *correctURL = [NSURL URLWithString:@"https://go.urbanairship.com/api/device_tokens/2d1535dfcbfd859b4f55e6b74db24c71cf6082b503d38583b0b20f2816c24ca8"];
NSString *password = [@"redacted" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:correctURL];
NSLog(@"httpClient url: %@", [httpClient baseURL]);
[httpClient setAuthorizationHeaderWithUsername:@"redacted" password:password];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"PUT" path:nil parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject){
NSLog(@"Success: %@", responseObject);
}failure:^(AFHTTPRequestOperation *operation, NSError *error){
NSLog(@"Failure: %@", error);
}];
[operation start];
Этот URL отлично работает в сафари. Есть идеи?