http://www.apple.com/iphone/softwareupdate/. Please upgrade to iPhone OS 3.0 before setting up Google Sync.
2. Perform a sync with iTunes to ensure that Contacts and Calendars from your iPhone are backed up to your computer. Learn More.
2. Open Mail, Contacts, Calendars.
3. Tap Add Account....
4. Select Microsoft Exchange.
6. Leave the Domain field blank.
7. Enter your full Google Account email address (including @mydomain.com) as the Username.
8. Enter your Google Account password as the Password.
9. Tap Next at the top of your screen.
9a. Choose Accept if the Unable to Verify Certificate dialog appears.
10. A new Server field will appear. Enter m.google.com.
11. Press Next at the top of your screen again.
12. Select the Google services you want to sync.
13. Unless you want to delete all the existing Contacts and Calendars on your phone, select the Keep on my iPhone option when prompted. This will also allow you to keep syncing with your computer via iTunes.
If you want to sync only the My Contacts group, you must choose to Delete Existing Contacts during the Google Sync install when prompted. If you choose to keep existing contacts, it will sync the contents of the "All Contacts" group instead.
You've set up Google Sync for your iPhone. Synchronization will begin automatically if you have Push enabled on your phone. You can also open the Mail, Calendar or Contacts app and wait a few seconds to start a sync.
Next learn how to choose which calendars to sync, if you'd like to enable multiple calendars.