What to Do if I Forget My iPhone Password
If you've forgotten the passcode to your new iPhone, you don't need to rush back to the Apple Store. All you need to do is connect your iPhone to the computer with which you last synced it and then perform a restore to return the phone to factory default settings, thus erasing the passcode. The process will not work on any other computer (a precaution to deter and prevent theft). Be sure not to guess the passcode repeatedly, as entering the wrong passcode too many times will disable the phone.
Restoring is typically the last resort in troubleshooting an iPhone. A restore sets your iPhone completely back to factory settings, so all of your information, settings and data will be erased. You can perform a restore directly on the phone or through iTunes. You can then immediately re-sync all of your apps, music, video and other data that you have stored in iTunes so you will only lose information that you did not have on your computer.
Preparing to Restore
Before you restore, make sure that you have the latest version of iTunes and iOS (Apple's OS X-based operating system for iPhones, iTouches and iPads) to help ensure that the restore runs smoothly. If you have an outdated version of either iTunes or iOS, your restore may glitch and cause even more problems on your iPhone. To download the latest version of iTunes, open the program on your computer, click "File" at the top of the screen and select "Check for Updates." To update your iOS, plug your phone into your computer, click on its name under "Devices" on the left side of the iTunes window and select "Check for Updates" in the center of the screen.
Performing a Restore
To perform a restore, connect your iPhone to your computer. Because your phone is locked, you must connect it to the computer to which it was last synced. Open iTunes, and click on the name of your iPhone under "Devices" on the left side of the iTunes window. Click the "Restore" button in the center of the screen. A dialog box appears. Click "Back Up" to ensure you don't lose your files and click "Restore" in the next box.
Setting Up Your Phone Again
When the restore is complete, a new screen will appear in the iTunes window asking if you would like to set up your iPhone as a new phone or from a backup. If you choose to setup from a backup, you can select the most recent backup from a drop-down menu and then follow the prompts to finish the setup. If you choose to set up your iPhone as a new phone, you will need to follow the same steps that you did when you first received it -- give it a name and select the media that you want to sync to it. The iTunes window will guide you through the process step by step.