是否可以加载外部index.html(包含cordova.js)而不是本地index.html?
我在 appdelegate.m 中找到了这段代码:
self.viewController.wwwFolderName = @"www";
self.viewController.startPage = @"index.html";
我尝试引用外部网址,但没有运气...有人知道这个问题的解决方案吗?
p.s.
使用 Android 很简单:
super.loadUrl("http://192.168.1.135:3000/");
我已经为我的项目(AppDelegate.m)做到了这一点:
self.viewController = [[[MainViewController alloc] init] autorelease];
self.viewController.useSplashScreen = YES; // YES;
self.viewController.wwwFolderName = @""; // @"www";
self.viewController.startPage = @""; // @"index.html";
self.viewController.invokeString = invokeString;
self.viewController.view.frame = viewBounds;
// Load request with new root URL
NSURL *urlOverwrite = [NSURL URLWithString:@"http://kyryll.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:urlOverwrite];
[self.viewController.webView loadRequest:request];
正如其他地方提到的,您尝试访问的网站必须列入白名单。
效果很好。我的外部站点位于本地 IIS 上,并且具有 cordova.js 以及一些插件。现在只需看看我是否能让 Apple 批准我的应用程序!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)