Compiling for iOS (iPhone, iPod Touch, iPad)
Compiling for iPhone/iPod Touch/iPad
* An Apple PC :- Apple does not allow GLBasic to install parts of their SDK on non-Apple branded hardware. As a result, you MUST have a Mac in order to compile for iPhone. GLBasic will provide an XCode project which you can then compile using a Mac. The code-signed program file must be copied as "iPhone" to the .app directory afterwards.
* GLBasic v7RC2 or later (or V8beta or later for iPad support)
* Xcode must be installed on your Apple PC (included on the Mac OS X DVD)
* To sell your application through the Apple store you need an application developers licence (currently $99US a year)
Special notes about these devices
* The resolution of the iPhone 320 x 480 (or 480 x 320 in landscape mode)
* The iPhone 4 and iPod Touch 4th gen have a resolution of 640x960, but can also run in standard 320x480 mode.
* Applications written for these devices are sandboxed - i.e. you cannot share data between two running applications.
* The iPhone has no keys, thus KEY() will always return 0.
* If the Home button is pressed, the OS will quit your program very quickly. There's very little time to save the current game status. The way to do this is by inserting a
which will be called automatically and write the status using OPENFILE. Do not try and perform any graphics functions at this point.
* If you enable Multitasking on iOS4 and higher, you will get
called when the app gets switched. Beware! In that case you might not get notified if your app gets deleted from the mutlitasking pane. In your info.plist you can enter a property "UIApplicationExitOnSuspend" BOOL=<TRUE> to disable multitasking.
* The acceleration sensor of the iPhone can be polled with GETJOYX(0), GETJOYY(0) and GETJOYZ(0) accordingly. The return values are the accelerations for each axis in "G" (9.81 m/s^2). The axes are defined as:
* The iPhone has multi touch. Each touch is treated as a "mouse device". See GETMOUSECOUNT().
Currently the following commands are working slow on the iPhone
Resolutions of the devices and universal binaries
You set the project options to the maximum desired size you want to support. The program will run on the device and yield the real resolution with GETSCREENSIZE to the program.
// [ Resolution Matrix ]
// XCode GLBasic iPod iPhone iPad
// iPhone+iPad,320x480 320x480 320x480 768x1024
// iPhone+iPad,640x960 320x480 640x960 768x1024
// iPhone ,320x480 320x480 320x480 320x 480
// iPhone ,640x960 320x480 640x960 320x 480
// XCode: Settings in the XCode project
// GLBasic: Project options in GLBasic IDE
// iPod: iOS 3.x or iPhone 2G, 3G, 3G[S]
// iPhone: iOS4.2+ and Retina display device
// (iPhone 4, iPod 4th gen)
// iPad: iPad with iOS <= 4.2 (so far)
// The device resolutions are what you get with
Compiling for iPhone
1) Write the next blockbuster program in GLBasic
2) Select "Options" from the "Project" menu
3) Change the "Platform Configuration" dropdown to "iPhone"
4) Select the resolution you would like to use from the "Resolution" dropdown
5) Click OK
6) Compile your application
7) Copy the resulting .xcodeproj file to your Apple Machine
8) Open the file in xcode
9) In the "Groups and Files" pane, select iPhoneInfo.plist
10) Change the "Bundle Identifier" to your signed Apple Developer ID (if you have one)
11) In your xcode folder, if the file iPhone_Prefix.pch file is missing, create an empty file and give it this name.
12) In the top pulldown of xcode, make sure you're set to either "Device - Release" or "Device - Debug", not "Device - Simulator"
12) Click the "Build and Go" button to compile your application
13) If your iPhone is connected to your Apple PC, your application will automatically be uploaded to it.
Compiling for the iPad
1) Plug in and sync the iPad to the Mac.
2) Open the XCode project (that's created by GLB)
3) Select "Release" in the project.
4) From the menu Project/Edit Active Target "appname".
5) Set Base SDK to iPhone 3.2.
6) Set Targeted Device Family]/b] to iPad.
7) Set iPhone OS Deployment Target to iPhone OS 3.2
8) Set the Code Signing Identity (if need be).
9) Hit "Build & Run".
How to change the name that appears under your icon on the iPhone
1. In Xcode on the left hand panel expand the Targets tree.
2. Double click the first item below - it would should be iPhone
3. The Target "iPhone" Info window should appear.
4. Select the Build Tab.
5. Scroll down to the Packaging Section and change the value in the Product Name field to your new application name. You can change the configuration at the top of this screen to All Configurations to ensure the app name is changed for all configs.
6. Close this window.
7. Go to Build on the main menu at the top of the screen and select Clean, and then clean all the dependencies.
The icon name change will take effect after your next compile.