Bra*_*row 6 plugins xcode3.2 ios cordova
我是一个完整的Phonegap新手,所以如果可以的话,请放轻松我:)
我已经安装了phonegap 1.5并且运行正常.我努力安装childbrowser插件,但我相信它现在已正确安装.但是,我似乎无法让儿童浏览器显示出来?我尝试过这里的各种教程(http://bit.ly/ifK9lM)和这里(http://bit.ly/wOlq6k).我没有遇到任何构建错误或控制台错误,但是当我点击链接时,子浏览器才显示.
当我点击我的按钮时,我进入控制台的所有内容都是"打开网址:http://www.google.com ".所以就好像它正在尝试......但我没有得到视觉输出?
我在我的www文件夹的根目录下的cordova.js文件中有ChildBrowser.js文件.我将所有Child浏览器插件文件添加到xcode中的插件文件夹中.
我正在使用Xcode 3.2.6
如果有人能够建议我做错了什么,那将非常感激.
我不能在这里发布所有相关代码,因为它只是失控.很高兴发布请求的代码.
这是我目前的appdelegate.h文件:
#import "AppDelegate.h"
#import "MainViewController.h"
#ifdef CORDOVA_FRAMEWORK
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVURLProtocol.h>
#else
#import "CDVPlugin.h"
#import "CDVURLProtocol.h"
#endif
#import "ChildBrowserCommand.h"
#import "ChildBrowserViewController.h"
@implementation AppDelegate
@synthesize invokeString, window, viewController;
//Code excluded for brevity here.....
#pragma UIWebDelegate implementation
- (void) webViewDidFinishLoad:(UIWebView*) theWebView
{
// only valid if FooBar.plist specifies a protocol to handle
if (self.invokeString)
{
NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
}
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
return [self.viewController webViewDidFinishLoad:theWebView];
}
- (void) webViewDidStartLoad:(UIWebView*)theWebView
{
return [self.viewController webViewDidStartLoad:theWebView];
}
- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
{
return [self.viewController webView:theWebView didFailLoadWithError:error];
}
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest: (NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
- (void) dealloc
{
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
这是我的index.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">
<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
<script type="text/javascript" charset="utf-8" src="ChildBrowser.js"></script>
<script type="text/javascript">
var childBrowser;
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady()
{
childBrowser = ChildBrowser.install();
}
function openChildBrowser(url)
{
try {
childBrowser.showWebPage(url);
}
catch (err)
{
alert(err);
}
}
</script>
</head>
<body onload="onBodyLoad()">
<h1>Hey, it's Cordova!</h1>
<button onclick="openChildBrowser('http://www.google.com');">Open Google</button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
布拉德
我遇到了和你一样的问题,并意识到这取决于我如何将文件添加到Xcode.确保您实际将文件拖到Xcode中的Plugins文件夹中 - 不要只将它们放在文件夹本身中.
还要确保添加.xib文件.如果您按照此处的说明操作:http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/他只提到添加.h ,.m和捆绑文件,但从屏幕截图中你可以看到xib文件也在那里.
您可能还需要升级到Xcode 4 - 在Xcode 4.2和Cordova 1.5上为我工作
归档时间: |
|
查看次数: |
5271 次 |
最近记录: |