小编Nis*_*eth的帖子

AFNetworking 2.0 Domain = AFNetworkingErrorDomain代码= -1011"请求失败:内部服务器错误(500)

我正在尝试使用子类AFHTTPRequestOperationManager将我的代码转换为AFNetworking 2.0.这是我的代码

+ (NSAFNetwokingRequestManager *)sharedClient {
    static NSAFNetwokingRequestManager *_sharedClient = nil;

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedClient = [[self alloc] initWithBaseURL:[NSURL URLWithString:GET_CAR_BRAND]];
    });
    return _sharedClient;
}
- (instancetype)initWithBaseURL:(NSURL *)url
{
    self = [super initWithBaseURL:url];
     if (self) {
    self.responseSerializer = [AFXMLParserResponseSerializer serializer];
    self.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/soap+xml"];
    self.requestSerializer = [AFHTTPRequestSerializer serializer];
    [self.requestSerializer setValue:@"application/soap+xml" forHTTPHeaderField:@"Content-type"];
}

    return self;
}
- (void)requestBrandcompletion:(NSAFNetwokingRequestManagerCompletionBlock)completion {
    NSString *soapRequest=@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
    "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
    "<soap:Body>\n"
    " <CarBrandExt xmlns=\"http://www.nohausystems.nl/\" />\n"
    "</soap:Body>\n"
    "</soap:Envelope>\n";
    NSString *msgLength = [NSString stringWithFormat:@"%i",[soapRequest length]]; …
Run Code Online (Sandbox Code Playgroud)

web-services ios afnetworking afnetworking-2

12
推荐指数
1
解决办法
9702
查看次数

标签 统计

afnetworking ×1

afnetworking-2 ×1

ios ×1

web-services ×1