这是我打开图片选择器的程序但是在执行到[self presentModalViewController:test animated:YES];就挂了。麻烦高手们帮忙看看。
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:test animated:YES];//执行到这里程序就崩了}
else {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"访问图片库错误"
message:@""
delegate:nil
cancelButtonTitle:@"OK!"
otherButtonTitles:nil];
[alert show];
[alert release];
}
//控制台提示的异常
2011-10-23 13:50:36.170 Ouyu[5630:207] -[NSCFString _isSupportedInterfaceOrientation:]: unrecognized selector sent to instance 0x6b49420
2011-10-23 13:50:36.172 Ouyu[5630:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString _isSupportedInterfaceOrientation:]: unrecognized selector sent to instance 0x6b49420'
*** Call stack at first throw:
(
0 CoreFoundation 0x018e3be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01a385c2 objc_exception_throw + 47
2 CoreFoundation 0x018e56fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01855366 ___forwarding___ + 966
4 CoreFoundation 0x01854f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x00485146 -[UITabBarController _doAllViewControllersSupportInterfaceOrientation:] + 207
6 UIKit 0x0046db4a -[UIViewController window:shouldAutorotateToInterfaceOrientation:] + 86
7 UIKit 0x003e7bf9 -[UIWindow _shouldAutorotateToInterfaceOrientation:] + 307
8 UIKit 0x003e58b2 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 84
9 UIKit 0x0066bbcb -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 5792
10 UIKit 0x00475982 -[UIViewController presentModalViewController:withTransition:] + 3151
11 UIKit 0x0046e269 -[UIViewController _tryRecursivelyPresentModalViewController:withTransition:] + 134
12 UIKit 0x0046e22d -[UIViewController _tryRecursivelyPresentModalViewController:withTransition:] + 74
13 UIKit 0x00475085 -[UIViewController presentModalViewController:withTransition:] + 850
14 Ouyu 0x0003bbc6 -[EditUserInfoViewController iconSetting:] + 283
15 UIKit 0x003c3a6e -[UIApplication sendAction:to:from:forEvent:] + 119
16 UIKit 0x004521b5 -[UIControl sendAction:to:forEvent:] + 67
17 UIKit 0x00454647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
18 UIKit 0x004531f4 -[UIControl touchesEnded:withEvent:] + 458
19 UIKit 0x003e80d1 -[UIWindow _sendTouchesForEvent:] + 567
20 UIKit 0x003c937a -[UIApplication sendEvent:] + 447
21 UIKit 0x003ce732 _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01fd9a36 PurpleEventCallback + 1550
23 CoreFoundation 0x018c5064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x018256f7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x01822983 __CFRunLoopRun + 979
26 CoreFoundation 0x01822240 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01822161 CFRunLoopRunInMode + 97
28 GraphicsServices 0x01fd8268 GSEventRunModal + 217
29 GraphicsServices 0x01fd832d GSEventRun + 115
30 UIKit 0x003d242e UIApplicationMain + 1160
31 Ouyu 0x0000255a main + 104
32 Ouyu 0x000024e9 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.大侠们能不能帮我分析下这是为什么?
UIImagePickerControllerDelegate委托也实现了,我在新建的项目中就能够实现这个方法。但是放到项目中一执行到[self presentModalViewController:test animated:YES];程序就挂了。
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:test animated:YES];//执行到这里程序就崩了}
else {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"访问图片库错误"
message:@""
delegate:nil
cancelButtonTitle:@"OK!"
otherButtonTitles:nil];
[alert show];
[alert release];
}
//控制台提示的异常
2011-10-23 13:50:36.170 Ouyu[5630:207] -[NSCFString _isSupportedInterfaceOrientation:]: unrecognized selector sent to instance 0x6b49420
2011-10-23 13:50:36.172 Ouyu[5630:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString _isSupportedInterfaceOrientation:]: unrecognized selector sent to instance 0x6b49420'
*** Call stack at first throw:
(
0 CoreFoundation 0x018e3be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01a385c2 objc_exception_throw + 47
2 CoreFoundation 0x018e56fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01855366 ___forwarding___ + 966
4 CoreFoundation 0x01854f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x00485146 -[UITabBarController _doAllViewControllersSupportInterfaceOrientation:] + 207
6 UIKit 0x0046db4a -[UIViewController window:shouldAutorotateToInterfaceOrientation:] + 86
7 UIKit 0x003e7bf9 -[UIWindow _shouldAutorotateToInterfaceOrientation:] + 307
8 UIKit 0x003e58b2 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 84
9 UIKit 0x0066bbcb -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 5792
10 UIKit 0x00475982 -[UIViewController presentModalViewController:withTransition:] + 3151
11 UIKit 0x0046e269 -[UIViewController _tryRecursivelyPresentModalViewController:withTransition:] + 134
12 UIKit 0x0046e22d -[UIViewController _tryRecursivelyPresentModalViewController:withTransition:] + 74
13 UIKit 0x00475085 -[UIViewController presentModalViewController:withTransition:] + 850
14 Ouyu 0x0003bbc6 -[EditUserInfoViewController iconSetting:] + 283
15 UIKit 0x003c3a6e -[UIApplication sendAction:to:from:forEvent:] + 119
16 UIKit 0x004521b5 -[UIControl sendAction:to:forEvent:] + 67
17 UIKit 0x00454647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
18 UIKit 0x004531f4 -[UIControl touchesEnded:withEvent:] + 458
19 UIKit 0x003e80d1 -[UIWindow _sendTouchesForEvent:] + 567
20 UIKit 0x003c937a -[UIApplication sendEvent:] + 447
21 UIKit 0x003ce732 _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01fd9a36 PurpleEventCallback + 1550
23 CoreFoundation 0x018c5064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x018256f7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x01822983 __CFRunLoopRun + 979
26 CoreFoundation 0x01822240 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01822161 CFRunLoopRunInMode + 97
28 GraphicsServices 0x01fd8268 GSEventRunModal + 217
29 GraphicsServices 0x01fd832d GSEventRun + 115
30 UIKit 0x003d242e UIApplicationMain + 1160
31 Ouyu 0x0000255a main + 104
32 Ouyu 0x000024e9 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.大侠们能不能帮我分析下这是为什么?
UIImagePickerControllerDelegate委托也实现了,我在新建的项目中就能够实现这个方法。但是放到项目中一执行到[self presentModalViewController:test animated:YES];程序就挂了。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货