0
My APP use  ASIHTTP request net data.But I got some crash like This. I guess this crash will happen when user set Pac Proxy.

<pre>


    0  JavaScriptCore                 0x18be7f418 WTFCrash + 72
    1  JavaScriptCore                 0x18be7f410 WTFCrash + 64
    2  JavaScriptCore                 0x18bbce2e0 JSC::MachineThreads::addCurrentThread() + 42
    3  JavaScriptCore                 0x18be11434 JSGlobalContextCreateInGroup + 172
    4  CFNetwork                      0x18a587854 CreateJSContextForAutoConfigurationScript + 788
    5  CFNetwork                      0x18a589ad4 PACCacheEntry_ConstructJSContext(void*) + 72
    6  CoreFoundation                 0x18a9a3644 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
    7  CoreFoundation                 0x18a9a29a0 __CFRunLoopDoSources0 + 256
    8  CoreFoundation                 0x18a9a0c38 __CFRunLoopRun + 632
    9  CoreFoundation                 0x18a8e1c20 CFRunLoopRunSpecific + 452
    10 CFNetwork                      0x18a586f8c CFNetworkCopyProxiesForAutoConfigurationScript + 156
    11 ***                          0x10073d8b0 +[ASIHTTPRequest proxiesForURL:fromPAC:] (ASIHTTPRequest.m:4163)


    </pre>

//编码

    PAC 脚本
    + (NSArray *)proxiesForURL:(NSURL *)来自 PAC 的 URL:(NSURL *)pacScriptURL
    {
        // 来自:http: //developer.apple.com/samplecode/CFProxySupportTool/listing1.html
        // 解决方法。这个虚拟调用
        // CFNetworkCopyProxiesForURL 在 CFNetwork 中初始化一些状态
        // 这是 CFNetworkCopyProxiesForAutoConfigurationScript 所要求的。
        CFRelease(CFNetworkCopyProxiesForURL((CFURLRef)theURL, NULL));

NSStringEncoding encoding; NSError *err = nil; NSString *script = [NSString stringWithContentsOfURL:pacScriptURL usedEncoding:&encoding error:&err]; if (err) { // If we can't fetch the PAC, we'll assume no proxies // Some people have a PAC configured that is not always available, so I think this is the best behaviour return [NSArray array]; } // Obtain the list of proxies by running the autoconfiguration script CFErrorRef err2 = NULL; NSArray *proxies = NSMakeCollectable([(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL, &err2) autorelease]); if (err2) { return nil; } return proxies; } </pre>
4

0 回答 0