我正在发送具有正确信息的 NSMutalbeDictionary 用户。
我使用这两种方法发送帖子。
+ (void)loginUsers:(NSMutableDictionary*)user {
NSString *endpoint = @"api/users/sign_in";
[self postEndpoint:endpoint params:user completionBlock:^(TSystemsResponse *response) {
}];
}
+ (void)postEndpoint:(NSString *)endpoint params:(NSMutableDictionary *)params completionBlock:(void (^)(TSystemsResponse *response))completionBlock {
[[TSystemsAPIClient sharedClient] postPath:[NSString stringWithFormat:@"/%@", endpoint] parameters:params success:^(AFHTTPRequestOperation *request, id responseObject) {
TSystemsResponse *resp = [[TSystemsResponse alloc] initWithDictionary:responseObject];
completionBlock(resp);
} failure:^(AFHTTPRequestOperation *request, NSError *error) {
NSLog(@"Request to /%@ FAILED: %@", endpoint, error);
completionBlock(nil);
}];
}
我收到来自服务器的回复,内容如下
{
"success": false,
"message": "Missing user parameter"
}
所以我认为我没有正确发送信息。API 调用在 Post man 中有效。