TimesToCome Mobile

iPhone Apps and Tips, tricks and tools for smart phones

Archive for August, 2008

Beginning iPhone coding, the good, the bad and the ugly

without comments

The Basics

It has been painful learning to write programs for the iPhone. My C++ is shamefully rusty and I’ve done everything from a command line for years. So I had to learn ObjC and how to develop code in XCode.

The first thing you must do is sign up for the iPhone Developer Program. There is a free program that will get you the developer kit, manuals, and source code. Pay $99 and you can obtain the certificates that will let you load code onto your phone for testing or put it up on the iTunes store.

Once you’ve signed up you’ll need to download and install the developer kit onto your computer.

If you plan to sell applications on the App store fill out your bank and tax information since it takes a long time for the contract information to get approved. ( iPhone Dev Center -> Program Portal -> Distribution -> App Store -> Learn more -> Go to iTunes Connect -> Contracts, Tax & Banking Information )

The Good

The pdf manuals you’ll find most useful for getting started in ObjC and XCode are:
iPhone OS Programming Guide
ObjC

Then move onto both of these pdfs which walk you through simple projects:
ObjCTutorial.pdf
iPhone101.pdf

Then download all the sample code, you use it often.

(* Note: you must sign up for the developer program to download these manuals and code from Apple. )

The icodeblog has several code examples and it walks you through in very tiny steps.

Another very useful blog with well explained examples and source code is MikeTeo.

Programming in Objective-C (Developer’s Library)‘is a great place to start if you are new to ObjC.

Cocoa(R) Programming for Mac(R) OS X (3rd Edition)‘ is good for learning Cocoa if you know ObjC but it is written for desktop application, not iPhone applications.

If you have written code for cell phones before you’ll find much of the interface stuff is familiar.  It’s just a matter of getting the hang of the Apple drag and drop GUI. You’ll probably want to start with Beginning iPhone Development: Exploring the iPhone SDK if you already know ObJC and Cocoa. I’m only on chapter 11but I can see already it’ll be a well used, well worn book. (Forums for book and the example code for the book )

iPhone Dev Central has forums and video tutorials. I’m not big on video tutorials so I haven’t tried them, but they come highly recommended.

If you want to write games you’ll have to brush up on or learn OpenGL and get the basics of that down. For a really cool example of 3d graphics on the iPhone check out iHologram

If you are totally new to programming you’ll want to download the free pdf or buy Thinking in C++: Introduction to Standard C++, Volume One (2nd Edition) and dig into code get your basic stuff down first.

Also see Miklos Fazekas’s Blog entry on Debugging iPhone provision profiles/certificates. It was a great help to me when I got trapped in certificate hell.

Another place you might get stuck is changing the name of your project in XCode, Me and Mark’s Xcode Tools Tips has some help for that.

Stanford iPhone class is now putting the whole class online not just the slides. I watched the intro lecture and already learned some new tricks.

The Bad

‘iPhone Open Application Development: Write Native Objective-C Applications for the iPhone‘ The ‘iPhone Open Application Development’ book looks to have some interesting information so far I haven’t found a use for any thing in it.

The Ugly

Do not purchase The iPhone Developer’s Cookbook: Building Applications with the iPhone SDK (Developer’s Library) it was a total waste of money and it’s not even large enough to make a good door stop.

When you are debugging and testing applications on your iPhone the gdb runs the existing application if it exists, not the new, leading to some embarrassing got-yas. Before testing, delete existing copies of the application from your phone.

There is little to no information or examples using OpenGL on the iPhone so I added a few to get you started.

Other useful things:
How to rotate a UITabBarController

Written by timestocome

August 27th, 2008 at 10:48 am

How to move photos into your iPhone Photo Library

without comments

Your iPhone photo library syncs with a folder on your computer. Plug in your phone, go to iTunes->Devices->Photos and select a folder to sync photos into (iPhonePhotos ).

Now when you sync your iPhone up comes Image Capture. Choose another folder (iPhonePhotoDownloads) to put photos into that you download from your iPhone. All photos you take on your device are downloaded to that folder.

* If Image Capture does not start automatically, you’ll find it in your Apps folder, just start it manually.

Once your photos are downloaded you’ll want to crop or shrink them to 480×360. If you do not iTunes will alter them and it usually rotates the photo sideways when it does so. So resize your photos, then move them from iPhonePhotoDownloads to iPhonePhotos.

Next time you sync the photos you took, resized and moved will be in your iPhone Photo Library.

I only put the photos I really like in the library.

I know this isn’t the easiest solution, but it works and if I figure out an easier way I’ll post it here.

Written by timestocome

August 8th, 2008 at 1:08 pm

Posted in iPhone help

Airplane mode and iPhone updates

without comments

If you do the software update on your old iPhone, or likely new one, while the phone is in airplane mode then when you are finished it will be stuck in a loop.

The iPhone will tell you to plug it in to iTunes, iTunes will tell you it can’t access the phone till the phone is activated.

To break the loop. Go to the phone and tell it you want to make an emergency call. It will tell it must turn off airplane mode. Tell to go ahead. Then you can plug it into iTunes and everything will work itself out and be fine.

Written by timestocome

August 4th, 2008 at 8:30 pm

Posted in iPhone help