【发布时间】:2014-03-15 04:24:24
【问题描述】:
我正在使用此代码仅使用 appID 从 appStore 获取应用程序的应用程序屏幕截图,
NSString *numericIDStr = appID;
NSString *urlStr = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@", numericIDStr];
NSURL *url = [NSURL URLWithString:urlStr];
NSData *json = [NSData dataWithContentsOfURL:url];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:json options:0 error:NULL];
NSArray *results = [dict objectForKey:@"results"];
NSDictionary *result = [results objectAtIndex:0];
myArray = [result objectForKey:@"screenshotUrls"];
我设法使用SDWebImage 缓存了屏幕截图,它运行良好,但我注意到每次调用此方法时它都会延迟大约 3-4 秒,而在 3G 上它会延迟更多,大约 10-15 秒。
以及我的应用在未连接到互联网时崩溃的其他问题,有没有办法缓存这种方法或类似的方法?
【问题讨论】:
标签: ios cocoa-touch caching nsurl