【问题标题】:App crashes on iPad 6.0.1 only应用程序仅在 iPad 6.0.1 上崩溃
【发布时间】:2012-12-14 18:30:29
【问题描述】:

我的应用有一个非常奇怪的问题。它可以在所有运行 iOS 6.0 的设备(甚至 iPad)上完美运行。在 iOS 6.0.1 中,它也可以在 iPhone 和 iPod 上正常运行。但是在 6.0.1 的 iPad 上它崩溃了。

这是一个非常简单的带有 webView 的单视图应用程序。这是我的 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

【问题讨论】:

  • 符号化你的崩溃日志:14 DieTelefonecke 0x00084f4e 0x83000 + 8014
  • 我在这里没有看到任何问题,因为这段代码在我运行 iOS 6.0.1 的设备上运行良好。问题必须在别处解决。就 Till 而言,象征性化,这样我们就可以看到它崩溃的地方。
  • 顺便说一句,我不知道你为什么要做所有关于重新加载视图、添加通知等的事情,因为页面仍然存在,但我假设你有一个原因。
  • 我不知道为什么,但目前 xcode 不会象征我的崩溃日志。我会尽快解决问题。 @Rob:我正在做所有这些事情,因为 webView 中显示的网站经常更新。
  • 该行将象征主函数调用。没用。

标签: objective-c ios ipad webview crash


【解决方案1】:

这是您的崩溃的符号化 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 是主要功能,因此无需担心。

所以加载主故事板时发生异常。那是您应该开始关注的地方,例如如果故事板是应用程序包等的一部分。

【讨论】:

  • 但是我可以如何以及在我的情节提要上改变什么?我的意思是它是 xcode 生成的。
  • 检查文档:developer.apple.com/library/ios/#documentation/uikit/reference/… 如果名称为 nil,则会引发异常。我从未使用过 Storyboard,所以除了指向文档之外,我无法告诉你为什么会发生这种情况。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-03-30
  • 1970-01-01
  • 2014-10-26
  • 2011-12-26
  • 1970-01-01
  • 2012-11-26
  • 1970-01-01
相关资源
最近更新 更多