Vic*_*Hee 5 iphone crash uiimagepickercontroller
大多数时候,我的图像选择器工作得很好(iOS 4.2.1).但是,如果我通过大约300张照片的相机卷上下快速地上下滚动4-6次,我就会崩溃.这种情况从未发生在同一iPhone 3G上的"照片"应用程序中.此外,我注意到股票"照片"应用程序滚动比我的图像选择器更顺畅.
有没有人注意到这种行为?如果其他人可以在他们自己的应用程序中尝试这个并看看他们是否崩溃,我会感兴趣.我不认为它与其他对象占用我的iPhone上的内存有关,因为它是一个简单的应用程序,这发生在我启动应用程序后.根据我的崩溃日志以及模拟器对模拟内存警告响应良好这一事实,它似乎与发送到其他已发布对象的消息或viewdidunload中其他对象的过度释放无关.我认为这可能是UIImagePickerController内部实现中的一个错误......
这就是我启动选择器的方式.我已经完成了多种方式(包括在我的标题中为UIImagePickerController设置retain属性并在dealloc上释放).这似乎是最好的方法(崩溃最少):
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.allowsEditing = YES;
[self presentModalViewController:picker animated:YES];
[picker release];
Run Code Online (Sandbox Code Playgroud)
这是崩溃的线程(我得到各种异常类型):
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xfffffffff4faafa4
Crashed Thread: 8
...
Thread 8 Crashed:
0 CoreFoundation 0x000494ea -[__NSArrayM replaceObjectAtIndex:withObject:] + 98
1 PhotoLibrary 0x00008e0f -[PLImageTable _segmentAtIndex:] + 527
2 PhotoLibrary 0x00008a21 -[PLImageTable _mappedImageDataAtIndex:] + 221
3 PhotoLibrary 0x0000893f -[PLImageTable dataForEntryAtIndex:] + 15
4 PhotoLibrary 0x000087e7 PLThumbnailManagerImageDataAtIndex + 35
5 PhotoLibrary 0x00008413 -[PLThumbnailManager _dataForPhoto:format:width:height:bytesPerRow:dataWidth:dataHeight:imageDataOffset:imageDataFormat:preheat:] + 299
6 PhotoLibrary 0x000b6c13 __-[PLThumbnailManager preheatImageDataForImages:withFormat:]_block_invoke_1 + 159
7 libSystem.B.dylib 0x000d6680 _dispatch_call_block_and_release + 20
8 libSystem.B.dylib 0x000d6ba0 _dispatch_worker_thread2 + 128
9 libSystem.B.dylib 0x0007b251 _pthread_wqthread + 265
Run Code Online (Sandbox Code Playgroud)
Vic*_*Hee 10
我找到了一个可以大大提高图像选择器滚动性能并完全消除崩溃的修复方法.不幸的是,我不知道为什么会这样.
在上面的代码中,更改:
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
Run Code Online (Sandbox Code Playgroud)
至:
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1778 次 |
| 最近记录: |