使用afnetworking,找不到404有效网址。同样的网址在帖子中工作得很好。
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[manager.requestSerializer setValue:[@"Bearer " stringByAppendingString:[[NSUserDefaults standardUserDefaults]valueForKey:@"authKey"]] forHTTPHeaderField:@"Authorization"];
[manager POST:[NSString stringWithFormat:@"http://api.fp.com/api/v1/vendor/NotifyConsumerAlbumIsCreated"] parameters:paramsDict success:^(AFHTTPRequestOperation *operation, id responseObject) {
if(completion)
completion(responseObject, YES);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error is %@",error);
}];
邮差回应
答案 0 :(得分:2)
如果您使用curl
标记-i
,则会发现您的网址存在问题:
$ curl -i -X POST http://api.fp.com/api/v1/vendor/NotifyConsumerAlbumIsCreated
HTTP/1.1 301 Moved Permanently
Date: Wed, 02 Nov 2016 09:58:55 GMT
Location: https://www.friendslife.co.uk/
Content-Length: 0
X-Powered-By: Servlet/2.4 JSP/2.0