Build for iOS

From RadPHP XE2 Documentation
Jump to: navigation, search
Tip: There is a video tutorial which goes through all the steps below.

Contents

Wizard for PhoneGap

To compile your application for iOS, you must first export it as a PhoneGap project:

  1. Go to Tools > Wizard for PhoneGap.
  2. In the PhoneGap wizard:
    1. Choose iOS as Target Device.
    2. Select the version you will be deploying for.
    3. Click Next.
  3. On the Application Setup page:
    1. Set Index page to the page to be displayed first when users run your application.
    2. In the Application name field, type your application’s name.
    3. In the Company name field, type the name of your company.
    4. Optionally, type your developer ID in Apple Developer ID field.
      Note: If you plan to upload your application to the App Store, you will need to sign it, for which you will need to have an Apple Developer ID. You can find more information about the topic at developer.apple.com/support/mac/.
    5. Click Next.
  4. On the iOS Graphics page, you can setup icons and splash screens for your application.
    1. To choose an image file for a field:
      1. Click .
      2. Go to image’s location, and select it.
      3. Click OK.
    2. Click Next.
  5. On the Choose Destination Folder page:
    Note: The folder you choose will be where all files and folders will be generated. You might want to create a new folder for your build.
    1. Optionally, change destination folder:
      1. Click .
      2. Go to folders location, and click OK.
    2. Click Next.
  6. On the next page, wait for the build process to end and then click Finish.

Project Folder

Once the Phonegap project folder is generated by the Wizard for PhoneGap:

  1. Copy any external resources you included in your application, like image files, into www folder. Check this video tutorial (around minute 6:25).
  2. If you are not using any MIFrame component in your project and you include some external links, you should set your application up so external links are open in device’s default web browser.

Then proceed to move generated PhoneGap folder to your Mac OS X system to complete the build steps.

External Links Setup

If you want external links to be opened in device’s default web browser instead of a page of PhoneGap web browser:

1. Open the Classes\AppDelegate.m file inside the project folder.
2. Locate the following lines of code:
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
 NSURL *url = [request URL];
  if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
    return YES;
  }
  else {
    return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
  }
}
3. Replace return YES; with return NO;.
4. Save the file.

XCode

Warning: Before you continue, do not forget to setup your system.

Once you are in your Mac OS X system, open the PhoneGap folder you generated with RadPHP, and inside it you will find YourApplication.xcodeproj. Open it with XCode.

Run

Once you open your project in XCode, follow these steps to run it in a real device or a simulator:

Device drop-down list.
  1. Set the device you want to use in the device drop-down list (top left). By default you can choose an iPad simulator, an iPhone simulator, or a real iOS device.
  2. Click Run button.

With simulators, you can stop it at any time by clicking the Stop button.

App Store Package

To create a package you can upload to the App Store, follow these steps:

  1. Choose iOS Device in the device drop-down list.
  2. Go to Product > Archive. Once the build is done, you will be taken to the Organizer, in the Archive tab.
  3. Click the Share button.
  4. On the dialog that will open:
    1. Set Contents to iOS App Store Package (.ipa).
    2. Choose your developer Identity you want to use for the package.
    3. Click Next.
  5. Choose a name for your package, a destination directory, and when you are done click Save.

You can now upload that package to the App Store for distribution. For that you need an an iOS developer account, so if you have not one already, get it from developer.apple.com/programs/start/ios/ and follow the indications you will be given by Apple.

Personal tools