5

I have two HTML files on my www folder using the PhoneGap framework. The iPhone/iPod one(/mobile/index.html) and the iPad one(/index.html). So I'm using this code at my AppDelegate.m:

+ (NSString*) startPage
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        return @"index.html";
    } else {
        return @"mobile/index.html";
    }
}

And edited my Targeted Device Family to iPhone/iPad.

But for some reason it won't work. When I put it on my iPad it still put the application on compatibility mode. What should I do?

Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
  • 1
    Nathan, I am trying to do the exact same thing, I dropped this function into my SanAntonioAppDelegate.m file and now the app crashes onload. I don't see any other function trying to call this startPage function. Could you please explain a little more where you put this in and a bit on how to get it working? – Landon Dec 15 '11 at 00:06
  • Strange, maybe it's your Xcode version. When I used this function I was using Xcode 3 with the iOS 4 SDK. I haven't tried this on my new iOS environment – Nathan Campos Dec 16 '11 at 16:47
  • well where exactly did you put it? i'm a noob to phonegap meaning i'm even more of a noob for this objective c stuff, how/where did you put this in? – Landon Dec 17 '11 at 00:16
  • You put this on the `AppDelegate.m` file that is on the Objective-C sources folder in your project – Nathan Campos Dec 18 '11 at 12:48

1 Answers1

3

Try the following:

  • Select your target.
  • Click on the Project menu & choose "Upgrade Current Target for iPad."
  • In the dialog box that comes up, you're given two choices. Select "One Universal Application."

Not sure that's what you're missing. But, if you haven't done it yet, it couldn't hurt.

salo.dm
  • 2,317
  • 1
  • 15
  • 16
  • That option is grey(disabled) **:/** – Nathan Campos Apr 23 '11 at 03:16
  • Make sure you have the target selected when you click on the Project menu. If the target isn't selected the option will be disabled. – salo.dm Apr 23 '11 at 03:21
  • But, if you do have the target selected and the option is disabled, it may be that you have effectively already done this. The option does not come up on the apps that I already have working on the iPad. Sorry, if this isn't the problem, I'm not sure what you're missing. – salo.dm Apr 23 '11 at 03:39