Pls help. Here is my code
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.delegate = self;
imagePickerController.allowsEditing=NO;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:imagePickerController animated:YES completion:nil];
//log is
Incident Identifier: 4EFA5353-D661-465B-8832-48EE31687371
CrashReporter Key: a71818384f31c76868d9987cbe27b1de500f8b8d
Hardware Model: iPad2,1
Process: Xpress [316]
Path: /private/var/mobile/Containers/Bundle/Application/222A7E73-F4E9-4FD9-8A8B-C51FB01D0660/Xpress.app/Xpress
Identifier: com.letsxprs.xpress2
Version: 1.0.9 (1.0.9)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-10-17 16:56:08.963 +0530
Launch Time: 2014-10-17 16:56:01.837 +0530
OS Version: iOS 8.0.2 (12A405)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xd000000c
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3a352f66 0x3a340000 + 77670
1 UIKit 0x301f933c 0x2fe19000 + 4064060
2 UIKit 0x2fefcab2 0x2fe19000 + 932530
3 UIKit 0x2ff805bc 0x2fe19000 + 1471932
4 PhotosUI 0x2f786114 0x2f624000 + 1450260
5 PhotosUI 0x2f725a24 0x2f624000 + 1055268
6 PhotosUI 0x2f634cdc 0x2f624000 + 68828
7 PhotosUI 0x2f637c38 0x2f624000 + 80952
8 PhotosUI 0x2f636dcc 0x2f624000 + 77260
9 PhotosUI 0x2f63941c 0x2f624000 + 87068
10 PhotosUI 0x2f63119a 0x2f624000 + 53658
11 UIKit 0x2fe3df6a 0x2fe19000 + 151402
12 UIKit 0x2ff9382a 0x2fe19000 + 1550378
13 UIKit 0x2ffb1c3e 0x2fe19000 + 1674302
14 UIKit 0x2fed165a 0x2fe19000 + 755290
15 UIKit 0x2fed145c 0x2fe19000 + 754780
16 UIKit 0x2fed13f4 0x2fe19000 + 754676
17 UIKit 0x2fe25d8a 0x2fe19000 + 52618
18 QuartzCore 0x2f8501d0 0x2f844000 + 49616
19 QuartzCore 0x2f84bbcc 0x2f844000 + 31692
20 QuartzCore 0x2f84ba54 0x2f844000 + 31316
21 QuartzCore 0x2f84b442 0x2f844000 + 29762
22 QuartzCore 0x2f84b24c 0x2f844000 + 29260
23 QuartzCore 0x2f845158 0x2f844000 + 4440
24 CoreFoundation 0x2c970842 0x2c8a2000 + 845890
25 CoreFoundation 0x2c96df24 0x2c8a2000 + 835364
26 CoreFoundation 0x2c96e326 0x2c8a2000 + 836390
27 CoreFoundation 0x2c8bbdac 0x2c8a2000 + 105900
28 CoreFoundation 0x2c8bbbbe 0x2c8a2000 + 105406
29 GraphicsServices 0x33bf004c 0x33be7000 + 36940
30 UIKit 0x2fe87a2c 0x2fe19000 + 453164
31 Xpress 0x00154c54 0xa6000 + 715860
32 libdyld.dylib 0x3a8e2aac 0x3a8e1000 + 6828
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3a9942c8 0x3a993000 + 4808
1 libdispatch.dylib 0x3a8b6ec4 0x3a8a5000 + 73412
2 libdispatch.dylib 0x3a8b6bf6 0x3a8a5000 + 72694
Thread 2:
0 libsystem_kernel.dylib 0x3a9a89cc 0x3a993000 + 88524
1 libsystem_pthread.dylib 0x3aa24e9c 0x3aa24000 + 3740
2 libsystem_pthread.dylib 0x3aa24b74 0x3aa24000 + 2932
Thread 3:
0 libsystem_kernel.dylib 0x3a9a89cc 0x3a993000 + 88524
1 libsystem_pthread.dylib 0x3aa24e9c 0x3aa24000 + 3740
2 libsystem_pthread.dylib 0x3aa24b74 0x3aa24000 + 2932
Thread 4:
0 libsystem_kernel.dylib 0x3a9a89cc 0x3a993000 + 88524
1 libsystem_pthread.dylib 0x3aa24e9c 0x3aa24000 + 3740
2 libsystem_pthread.dylib 0x3aa24b74 0x3aa24000 + 2932
请帮助。我正在使用UIImagePickerController
从图库中选择图片。我在所有iPhone
上工作得很好。但它在iPad iOS 8.0.2中崩溃了。显示图像选择器控制器。 (所有照片和最近添加的)选项显示。但是,当我点击上面任何一个时,应用程序崩溃..这只发生在iPad iOS 8.0.2。
答案 0 :(得分:0)
在iPad
上,present
image picker
的正确方法是使用popover
。检查official document。另请检查example
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
//Present in Popover
}
else
{
self presentViewController:imagePickerController animated:YES completion:nil];
}