Phonegap Xcode当点击状态栏时,iOS应用程序崩溃 [英] Phonegap Xcode iOS app crashes when status bar is tapped

查看:147
本文介绍了Phonegap Xcode当点击状态栏时,iOS应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Xcode 4.3.1与Phonegap 1.4.1构建一个iPhone应用程序。每当我点击状态栏滚动到顶部,该应用程序崩溃与一个EXC_BAD_ACCESS错误。

I'm using Xcode 4.3.1 with Phonegap 1.4.1 to build an iPhone app. Whenever I tap the status bar to scroll to top, the app crashes with an EXC_BAD_ACCESS error.

我已经尝试实现一些建议,如

I've tried implementing a number of suggestions such as this .

我还尝试添加以下代码的变体:

I've also tried adding variations of the below code:

[[[theWebView subviews] objectAtIndex:0] setScrollsToTop:NO];

((UIScrollView*)[theWebView.subviews objectAtIndex:0]).scrollsToTop = NO;

- (void) webViewDidFinishLoad:(UIWebView*) theWebView 
{
 ...
}

在AppDelegate.m中

within the AppDelegate.m

但是,我已经无法解决问题。我的主要关注是停止应用程序形式崩溃,任何洞察将非常感谢。

However, I've have been unable to resolve the issue. My main concern is to stop the app form crashing, any insight would be greatly appreciated.

推荐答案

我使用cordova 1.7并有同样的问题。我发现了一个解决方法。你需要补丁phonegap通过注释创建不可见的iframe是通过phonegap注入与本机通信。事实上,这个iframe导致各种渲染问题,不仅仅是状态栏问题:

I am using cordova 1.7 and have the same problem. I found a workaround though. You need to patch phonegap by commenting out the creation of invsible iframe which is injected by phonegap to communicate with the native side. In fact, this iframe causes all kinds of rendering issues, not only the status bar problem:

if (cordova.commandQueue.length == 1 && !cordova.commandQueueFlushing) {
//        if (!gapBridge) {
//            createGapBridge();
//        }
//        gapBridge.src = "gap://ready";
    location = "gap://ready";
}

我在进行上述更改后没有发现任何副作用。但是,我知道有人抱怨有些插件停止工作,例如。 google分析。

I didn't find any side effects after I've made the above change. However, I know people complain that some plugins stopped working, e.g. google analytics.

这篇关于Phonegap Xcode当点击状态栏时,iOS应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆