我的应用程序有一个非常奇怪的问题。它可以在运行iOS 6.0的所有设备(甚至是iPad)上完美运行。在iOS 6.0.1中,它也可以按预期在iPhone和iPod上运行。但是在装有6.0.1的iPad上,它会崩溃。
这是一个非常简单的带有WebView的单 View 应用程序。这是我的ViewControler.m:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
NSURL *url = [NSURL URLWithString:@"http://telefonecke.tumblr.com"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[_webView loadRequest:req];
[super viewDidLoad];
}
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
return YES;
}
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[_webView reload];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
}
- (void)willEnterForeground {
[_webView reload];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我实际上不知道为什么它不起作用,特别是因为它可以在iOS 6.0和所有其他设备上完美运行。
我很感谢每个建议。提前致谢!
编辑:如果有帮助,我也有崩溃报告:click here for the crash report
最佳答案
这是崩溃的符号化的Last Exception Backtrace:
Last Exception Backtrace:
0 CoreFoundation 0x327fb29e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x394dd97a objc_exception_throw + 26
2 UIKit 0x38897d54 +[UIStoryboard storyboardWithName:bundle:] + 436
3 UIKit 0x386da406 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 38
4 UIKit 0x38563794 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 524
5 UIKit 0x3850bc34 -[UIApplication handleEvent:withNewEvent:] + 1000
6 UIKit 0x3850b6c8 -[UIApplication sendEvent:] + 68
7 UIKit 0x3850b116 _UIApplicationHandleEvent + 6150
8 GraphicsServices 0x35c8759e _PurpleEventCallback + 586
9 CoreFoundation 0x327d067e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
10 CoreFoundation 0x327cfee4 __CFRunLoopDoSources0 + 208
11 CoreFoundation 0x327cecb2 __CFRunLoopRun + 642
12 CoreFoundation 0x32741eb8 CFRunLoopRunSpecific + 352
13 CoreFoundation 0x32741d44 CFRunLoopRunInMode + 100
14 UIKit 0x38562478 -[UIApplication _run] + 664
15 UIKit 0x3855f2f4 UIApplicationMain + 1116
16 DieTelefonecke 0x84f4e 0x83000 + 8014
您的应用程序调用
0x84f4e
是主要功能,因此无需担心。因此,加载主 Storyboard时会发生异常。那就是您应该开始研究的地方,例如如果 Storyboard 是应用程序包的一部分,等等。
关于objective-c - 应用程序仅在iPad 6.0.1上崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13884346/