在iOS上使用Cordova 1.6设置外部起始页

mar*_*006 5 external ios cordova

是否可以加载外部index.html(包含cordova.js)而不是本地的?

我发现在appdelegate.m中这段代码:

self.viewController.wwwFolderName = @"www";
self.viewController.startPage = @"index.html";
Run Code Online (Sandbox Code Playgroud)

我试图引用一个外部网址,但没有运气......任何人都知道这个解决方案?

PS

使用android很简单:

super.loadUrl("http://192.168.1.135:3000/");
Run Code Online (Sandbox Code Playgroud)

Kyr*_*aum 4

我已经为我的项目(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];
Run Code Online (Sandbox Code Playgroud)

正如其他地方提到的,您尝试访问的网站必须列入白名单。

效果很好。我的外部站点位于本地 IIS 上,并且具有 cordova.js 以及一些插件。现在只需看看我是否能让 Apple 批准我的应用程序!