Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIWebView负载崩溃[\uuu NSCFDictionary\uu dischargeEnabled]_Iphone_Html_Crash_Webview - Fatal编程技术网

Iphone UIWebView负载崩溃[\uuu NSCFDictionary\uu dischargeEnabled]

Iphone UIWebView负载崩溃[\uuu NSCFDictionary\uu dischargeEnabled],iphone,html,crash,webview,Iphone,Html,Crash,Webview,我使用UIWebView加载此网站 有时,如果我在该站点中触摸视图或播放音频,我的应用程序会崩溃,有时不会,为什么? 是因为html5吗?如何解决? 其他网站是没有问题的 事故日志是 *-[MPTransportButton\u DischargeEnabled]:发送到解除分配实例0x20aa58d0的消息 非常感谢您的帮助 ---更新--- 我创建了一个新的视图库项目,ViewController中的代码如下 这一次,崩溃日志是 2011-08-16 18:11:25.450 WebTest

我使用UIWebView加载此网站

有时,如果我在该站点中触摸视图或播放音频,我的应用程序会崩溃,有时不会,为什么?
是因为html5吗?如何解决? 其他网站是没有问题的

事故日志是 *-[MPTransportButton\u DischargeEnabled]:发送到解除分配实例0x20aa58d0的消息

非常感谢您的帮助

---更新---

我创建了一个新的视图库项目,ViewController中的代码如下

这一次,崩溃日志是

2011-08-16 18:11:25.450 WebTest[1291:707] -[__NSCFDictionary _isChargeEnabled]: unrecognized selector sent to instance 0x1ede0a10
2011-08-16 18:11:25.462 WebTest[1291:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary _isChargeEnabled]: unrecognized selector sent to instance 0x1ede0a10'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x30ea764f __exceptionPreprocess + 114
    1   libobjc.A.dylib                     0x349c2c5d objc_exception_throw + 24
    2   CoreFoundation                      0x30eab1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
    3   CoreFoundation                      0x30eaa649 ___forwarding___ + 508
    4   CoreFoundation                      0x30e21180 _CF_forwarding_prep_0 + 48
    5   UIKit                               0x30f232bd -[UIWindow warpPoint:] + 200
    6   UIKit                               0x30f0c1d5 _UIApplicationHandleEvent + 2404
    7   GraphicsServices                    0x30790e77 PurpleEventCallback + 666
    8   CoreFoundation                      0x30e7ea97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
    9   CoreFoundation                      0x30e8083f __CFRunLoopDoSource1 + 166
    10  CoreFoundation                      0x30e8160d __CFRunLoopRun + 520
    11  CoreFoundation                      0x30e11ec3 CFRunLoopRunSpecific + 230
    12  CoreFoundation                      0x30e11dcb CFRunLoopRunInMode + 58
    13  GraphicsServices                    0x3079041f GSEventRunModal + 114
    14  GraphicsServices                    0x307904cb GSEventRun + 62
    15  UIKit                               0x30f37d69 -[UIApplication _run] + 404
    16  UIKit                               0x30f35807 UIApplicationMain + 670
    17  WebTest                             0x00013425 main + 48
    18  WebTest                             0x000133f0 start + 40
)
terminate called after throwing an instance of 'NSException'
项目中的源代码,这次不要使用MPMoviePlayerController或其他东西

 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [self init];
    return self;
}

- (id)init
{
    if (self = [super initWithNibName:nil bundle:nil])
    {
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
    [web loadRequest:[NSURLRequest requestWithURL:
                      [NSURL URLWithString:@"http://www.xiami.com/song/1024665"]]];
    web.delegate = self;
    [self.view addSubview:web];
    [web release];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    return YES;
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    //[webView stringByEvaluatingJavaScriptFromString:@"window.scrollTo(0, 10);"];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
}

您发布的代码中没有任何错误

NSZombie
表示在您的代码中有一个先前被释放(释放)的
MPTransportButton
,之后,在代码中的其他地方,您想对它做些什么

我认为您可以使用
UIWebView
的委托方法之一来完成


但是我们需要更多的代码。您的
MPMoviePlayerController
在哪里
alloc/init
?或者您是
alloc/init
a
MPTransportButton

正如崩溃日志所说,您的MPTransportButton被过早释放。您可能想粘贴初始化/释放此按钮的代码。@直到我将源代码粘贴到我的项目中,并且我已经编辑了问题“您的代码是否正常”-我自己尝试过。您的目标是哪个iOS版本?@tilo iOS SDK4.3 xcode 3.2.6您是否解决了此问题?我在通过UIWebView启动HTML-5视频时也遇到了同样的症状。这似乎与更改应用程序方向有关。我编辑了我的问题,这次您可以看到源代码。该应用程序有时会崩溃,有时不会。