240 发简信
IP属地:北京
  • 你好,有个问题遇到了,在使用这个做webview的缓存的时候,特别问下哈

    start loading 里面的这个,就是走了缓存了
    if (data) { NSURLResponse *response = [[NSURLResponse alloc] initWithURL:mutableReqeust.URL MIMEType:[NSData sd_contentTypeForImageData:data] expectedContentLength:data.length textEncodingName:nil]; [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; [self.client URLProtocol:self didLoadData:data]; [self.client URLProtocolDidFinishLoading:self]; } else { self.connection = [NSURLConnection connectionWithRequest:mutableReqeust delegate:self]; }

    完了,如果我后台去请求下载这个URL,完了,更新缓存,完了 怎么样 更新 当前页面呢? 因为当前页面用的是 一进来从缓存拿到的数,后来我又在后台更新了缓存,有可能 缓存不一样了,所以我要顺便也更新下 当前页面,如果调用
    [self.client URLProtocol:self didReceiveResponse
    [self.client URLProtocol:self didLoadData
    [self.client URLProtocolDidFinishLoading
    这三个代理方法,我看了是不管用的,也就是说webview当前页面,并没有二次更新下页面(最最新的缓存)

    - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { self.responseData = [[NSMutableData alloc] init]; [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [self.responseData appendData:data]; [self.client URLProtocol:self didLoadData:data]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { UIImage *cacheImage = [UIImage sd_imageWithData:self.responseData]; //利用SDWebImage提供的缓存进行保存图片 [[SDImageCache sharedImageCache] storeImage:cacheImage recalculateFromImage:NO imageData:self.responseData forKey:[[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL] toDisk:YES]; [self.client URLProtocolDidFinishLoading:self]; }

    iOS中的 NSURLProtocol

    最近做SDK开发的时候,为了给QA编写一个测试工具,方便调试和记录请求内容。但是又不想改动已经写好的SDK代码。本来想到用methodSwizzle,但是发现SDK要开放一些...

  • @黑超熊猫zuik

    还原出来成这样的

    5 UIKit -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 692
    6 UIKit -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
    7 UIKit -[UITableView _updateVisibleCellsNow:isRecursive:] + 2360
    8 UIKit -[UITableView _performWithCachedTraitCollection:] + 104
    9 UIKit -[UITableView layoutSubviews] + 176
    10 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
    11 QuartzCore -[CALayer layoutSublayers] + 148
    12 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 292
    13 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
    14 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 252
    15 QuartzCore CA::Transaction::commit() + 512
    16 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80

    iOS Crash分析必备:符号化系统库方法

    如果你有过分析iOS崩溃日志的经验,一定经常看到日志里出现很多<redacted>的字段。这篇文章就是帮助开发者将这些字段符号化为对应的系统库方法名。 如果你已经掌握了这方面...

  • @黑超熊猫zuik

    我是想把这些系统方法的调用堆栈

    5 UIKit 0x00000001873dd31c 0x187078000 + 3560220
    6 UIKit 0x00000001873dd484 0x187078000 + 3560580
    7 UIKit 0x00000001873cc7e8 0x187078000 + 3491816
    8 UIKit 0x00000001873e1fb0 0x187078000 + 3579824
    9 UIKit 0x000000018717708c 0x187078000 + 1044620
    10 UIKit 0x0000000187087778 0x187078000 + 63352
    11 QuartzCore 0x0000000184a96b2c 0x184a88000 + 60204
    12 QuartzCore 0x0000000184a91738 0x184a88000 + 38712
    13 QuartzCore 0x0000000184a915f8 0x184a88000 + 38392
    14 QuartzCore 0x0000000184a90c94 0x184a88000 + 35988
    15 QuartzCore 0x0000000184a909dc 0x184a88000 + 35292
    16 QuartzCore 0x0000000184a8a0cc 0x184a88000 + 8396

    iOS Crash分析必备:符号化系统库方法

    如果你有过分析iOS崩溃日志的经验,一定经常看到日志里出现很多<redacted>的字段。这篇文章就是帮助开发者将这些字段符号化为对应的系统库方法名。 如果你已经掌握了这方面...

  • @黑超熊猫zuik
    21 UIKit 0x24f38ead <redacted> + 1076
    22 UIKit 0x24f385f1 <redacted> + 72
    23 UIKit 0x2522b8e9 <redacted> + 676
    24 UIKit 0x24f38013 <redacted> + 266
    25 UIKit 0x24fd261d <redacted> + 348
    26 UIKit 0x24fb65f5 <redacted> + 2524
    27 UIKit 0x24f29047 <redacted> + 514
    28 QuartzCore 0x24952dcd <redacted> + 136
    29 QuartzCore 0x2494e7b9 <redacted> + 360
    30 UIKit 0x24f3b7c3 <redacted> + 138
    31 UIKit 0x24f385f1 <redacted> + 72
    32 UIKit 0x24fb5455 <redacted> + 796
    33 UIKit 0x24fb50eb <redacted> + 202
    34 UIKit 0x24fb483d <redacted> + 804
    35 UIKit 0x2521d473 <redacted> + 142
    36 UIKit 0x24fb1c57 <redacted> + 186
    37 UIKit 0x24f2b951 <redacted> + 68
    38 UIKit 0x24f2b8d5 <redacted> + 24
    39 UIKit 0x24fb167d <redacted> + 392
    40 UIKit 0x2521f899 <redacted> + 356
    41 UIKit 0x24fb14e5 <redacted> + 492
    42 appName 0x126bef appName + 1190895

    iOS Crash分析必备:符号化系统库方法

    如果你有过分析iOS崩溃日志的经验,一定经常看到日志里出现很多<redacted>的字段。这篇文章就是帮助开发者将这些字段符号化为对应的系统库方法名。 如果你已经掌握了这方面...