ios - 更改viewController iOS4.3后崩溃

标签 ios objective-c xcode crash-reports

我想知道为什么我的iOS应用程序出现此崩溃(部署目标iOS 4.3-xcode 4)。

我在iPad模拟器5.0至6.1中进行了测试,并能100%地工作,但是在装有iOS 4.3的iPad中使用了它(嗯,这不是我的,所以我无法更新iOS,但最好使用旧的iOS版本进行实践)使应用崩溃,原因是:

2013-02-07 16:07:45.093 GeoRuta[169:707] -[mainViewController presentViewController:animated:completion:]: unrecognized selector sent to instance 0x331960
2013-02-07 16:07:45.113 GeoRuta[169:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[mainViewController presentViewController:animated:completion:]: unrecognized selector sent to instance 0x331960'
*** Call stack at first throw:
(
0   CoreFoundation                      0x30f8064f __exceptionPreprocess + 114
1   libobjc.A.dylib                     0x32828c5d objc_exception_throw + 24
2   CoreFoundation                      0x30f841bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3   CoreFoundation                      0x30f83649 ___forwarding___ + 508
4   CoreFoundation                      0x30efa180 _CF_forwarding_prep_0 + 48
5   GeoRuta                             0x00003781 -[mainViewController saltarConfiguracion:] + 184
6   CoreFoundation                      0x30ef0571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
7   UIKit                               0x3575eec9 -[UIApplication sendAction:to:from:forEvent:] + 84

8   UIKit                               0x3575ee69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
9   UIKit                               0x3575ee3b -[UIControl sendAction:to:forEvent:] + 38
10  UIKit                               0x3575eb8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
11  UIKit                               0x3575f423 -[UIControl touchesEnded:withEvent:] + 342
12  UIKit                               0x3575dbf5 -[UIWindow _sendTouchesForEvent:] + 368
13  UIKit                               0x3575d56f -[UIWindow sendEvent:] + 262
14  UIKit                               0x35746313 -[UIApplication sendEvent:] + 298
15  UIKit                               0x35745c53 _UIApplicationHandleEvent + 5090
16  GraphicsServices                    0x31a4de77 PurpleEventCallback + 666
17  CoreFoundation                      0x30f57a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
18  CoreFoundation                      0x30f5983f __CFRunLoopDoSource1 + 166
19  CoreFoundation                      0x30f5a60d __CFRunLoopRun + 520
20  CoreFoundation                      0x30eeaec3 CFRunLoopRunSpecific + 230
21  CoreFoundation                      0x30eeadcb CFRunLoopRunInMode + 58
22  GraphicsServices                    0x31a4d41f GSEventRunModal + 114
23  GraphicsServices                    0x31a4d4cb GSEventRun + 62
24  UIKit                               0x35770d69 -[UIApplication _run] + 404
25  UIKit                               0x3576e807 UIApplicationMain + 670
26  GeoRuta                             0x000030a9 main + 172
27  GeoRuta                             0x00002ff8 start + 40
)
terminate called after throwing an instance of 'NSException'

选择器是:
- (IBAction) saltarConfiguracion: (id)sender
{
    configuracionViewController *obj = [[configuracionViewController alloc]initWithNibName:@"configuracionViewController" bundle:nil];
    [self presentViewController:obj animated:YES completion:nil];
}

最佳答案

因为[self presentViewController:obj animated:YES completion:nil]是iOS 5的新方法。您不能在iOS 4上使用它。相反,请尝试调用[self presentModalViewController:obj animated:YES](类似这样)

关于ios - 更改viewController iOS4.3后崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14756058/

相关文章:

ios - Kingfisher 检查 404 状态

使用 iOS 11 的 iPhone 使用相机并锁定屏幕后 iOS 应用程序崩溃

ios - 如何使用NSURLCache?

javascript - 为什么以下 Objective-C 代码在调用方法 stringByEvaluatingJavaScriptFromString 时停止?

swift - 函数 opaque 返回类型被推断为 ... 它根据自身定义了 opaque 类型

iphone - 在 objective c iPhone 中绘制标尺

objective-c - 在 iOS 设备之间发送数据时委托(delegate)响应选择器崩溃

ios - 如何使用 iOS SDK(核心音频)将原始 PCM 保存到文件中?

ios - Objective C float 与 int、CGPoint 与基于自定义 int 的结构性能

ios - 导航 Controller 按下后的 View 高度不正确