次の関数を使用してビューから画像を生成しています
-(void)preparePhotos
{
[assetGroup enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop)
{
if(result == nil)
{
return;
}
NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
UIImage *img = [[UIImage imageWithCGImage:[[result defaultRepresentation] fullResolutionImage]] resizedImageToSize:CGSizeMake(600, 600)];
[workingDictionary setObject:img forKey:@"UIImagePickerControllerOriginalImage"];
[appdelegate.arrImageData addObject:workingDictionary];
}];
}
しかし、この関数が呼び出される回数が増えると、アプリがクラッシュします。この関数または代替関数を最適化して、このような crash.function 呼び出しに至らないデバイス ギャラリーから画像を取得するにはどうすればよいですか。
[self performSelectorInBackground:@selector(preparePhotos) withObject:nil];