1
有誰知道如何在AFHTTPSessionOperation中設置票證? 這是使用AFNetworking框架1.0如何使用AFHTTPSessionOperation或AFHTTPSessionManager設置票證?
NSURLRequest* request = [self.myClient requestWithMethod:@"POST" path:[NSString stringWithFormat:@"%@/%@", controller, action] parameters:parameters];
AFHTTPRequestOperation* operation = [self.myClient HTTPRequestOperationWithRequest:request success:success failure:failure];
[self.mirrorClient enqueueHTTPRequestOperation:operation];
票證存儲在self.myClient內以前調用。 self.myClient.ticket
但我不知道如何在以下使用AFNetworking框架3.1使用AFHTTPSessionOperation調用實現。
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] init];
AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer = manager.requestSerializer;
[requestSerializer setValue:[NSString stringWithFormat:@"%@", self.myClient.ticket] forHTTPHeaderField:@"Authorization"];
NSOperation *operation = [AFHTTPSessionOperation operationWithManager:manager HTTPMethod:@"POST"
URLString:urlString parameters:parameters
uploadProgress:nil downloadProgress: nil
success:success failure:failure];
謝謝
你是對的!問題來自我的票證,它沒有正確的數據。 – Aviva