Is PhoneGap on iOS hard coded to load www/index.html?

前端 未结 4 523
花落未央
花落未央 2021-02-06 06:30

On PhoneGap on Android you can modify the App.java class to load any url. I can\'t find anywhere to change the entry point on the iOS version.

When testing I prefer to h

4条回答
  •  隐瞒了意图╮
    2021-02-06 07:01

    PhoneGapDelegate.h defines a class method startPage which you can overload/redefine in your iOS app's AppDelegate.m file.

    + (NSString*) startPage;
    

    For example:

    + (NSString*) startPage{ 
        return @"http://m.google.com";
    }
    

    Will redefine the start page in PhoneGap. You will have to add google.com to your ExternalHosts in PhoneGap.plist. As of PhoneGap 1.2 If you do this and include Plugins in your native app, remotely host PhoneGap apps and their related *.js WILL be able to preform plugin actions. I've tested this with BarcodeScanner, ChildBrowser and ApplicationPreferences.

    UPDATE

    As of 1.4.0 and 1.4.0, startPage and wwwFolderName are properties instead of methods. They are still redefinable, but you can no longer have startPage point to a remote (non-local) phonegap installation like in my above example. (Which is kind of a bummer)

提交回复
热议问题