• 请不要在回答技术问题时复制粘贴 AI 生成的内容
iamjjh
V2EX  ›  程序员

最新版 AFNetworing 如何允许自建证书通过?

  •  
  •   iamjjh · Nov 6, 2015 · 2800 views
    This topic created in 3886 days ago, the information mentioned may be changed or developed.

    AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:baseURL];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    manager.requestSerializer.timeoutInterval = 10;
    manager.securityPolicy.allowInvalidCertificates = YES;
    manager.responseSerializer.acceptableContentTypes =[NSSet setWithObjects:@"text/html", @"text/plain",nil];
    manager.securityPolicy.allowInvalidCertificates = YES;
    manager.securityPolicy.validatesDomainName = NO;

    设置了以上代码并没有卵用,请问如何解决这个问题?一直报
    error:Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn ’ t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x7fbf6a48a850 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

    dorentus
        1
    dorentus  
       Nov 6, 2015 via iPhone
    你这个错误是 JSON 解析失败吧
    iamjjh
        2
    iamjjh  
    OP
       Nov 6, 2015
    @dorentus 不是
    iamjjh
        3
    iamjjh  
    OP
       Nov 6, 2015
    @dorentus 还真是解析失败,😓,我错了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:23 · PVG 05:23 · LAX 14:23 · JFK 17:23
    ♥ Do have faith in what you're doing.