0
나는 응답하지만, 엑스 코드를 얻고을 나는 오류가 발생했습니다 여기 내 코드입니다 : HTTP 400 오류가 서버 측 응용 프로그램을 의미 서버에서 반환
NSString *tokenStr=[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults]objectForKey:@"token"]];
NSString *newString = [tokenStr stringByReplacingOccurrencesOfString:@"\"" withString:@""];
NSLog(@"Token iss %@",newString);
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager.requestSerializer setValue:newString forHTTPHeaderField:@"Authorization-Token"];
[manager.requestSerializer setValue:@"5C063BDB-40EC-4EDE-8C0C-830D4437E056" forHTTPHeaderField:@"Authorization-Key"];
[manager.requestSerializer setValue:@"[email protected]" forHTTPHeaderField:@"UserName"];
[manager.requestSerializer setValue:@"123456" forHTTPHeaderField:@"UserPassword"];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html",@"text/plain", nil];
[manager GET:BaseURLStringLogin parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Bhai Error: %@", error);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Data"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
}];
가 표시 오류입니다. 감사합니다 –
동일한 문제가 있지만'manager.requestSerializer = [AFJSONRequestSerializer serializer];에 의해 해결되었습니다. – Shahrukh