プロジェクトに最新バージョンの MWPhotoBrowser クラスをインポートしましたが、ブラウザが Web から画像をロードすると、アプリがクラッシュします。実装では、デモ プロジェクトで作成されたものと同じコードを使用します。ローカルの画像を表示すれば問題ありません。これは私の実装です:
[galleryPhotosArray addObject:[MWPhoto photoWithImage:[UIImage imageNamed:@"Blue_Screen_iPhone.png"]]];
[galleryPhotosArray addObject:[MWPhoto photoWithImage:[UIImage imageNamed:@"Logo_iPhone.png"]]];
[galleryPhotosArray addObject:[MWPhoto photoWithURL:[NSURL URLWithString:@"http://www.cellulare.it/wp-content/uploads/2013/09/apple1.png"]]];
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = YES;
browser.displayNavArrows = NO;
browser.wantsFullScreenLayout = YES;
browser.zoomPhotosToFill = YES;
[browser setCurrentPhotoIndex:0];
[self.navigationController pushViewController:browser animated:YES];
[browser release];
だから私は2つのローカル画像とGoogle画像からのランダムな画像を追加します. アプリは次の行の SDWebImageDownloaderOperation.m で 2 つのポイントでクラッシュすることがあります。
self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO];
2 番目のポイントは、SDImageCache.m ファイルの - (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path メソッドにあります。