【发布时间】: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