Before You Sell Your iPhone
Before you give away or sell your iPhone, you want to be sure to set it to its factory default state for the new owner. Also, be sure to remove all your personal data and any valuable information in order to protect your privacy. Here are the steps you need to take:
BACK UP YOUR DEVICE
Sign out of iCloud. To achieve this, tap Settings > iCloud. Scroll down, then tap Sign Out (in iOS 7 or earlier iOS, tap Delete Account). Tap Sign Out again, tap Delete from My iPhone and enter your password. Go to Settings > General > Reset, then tap Erase All Content and Settings. This procedure will erase your device, including any credit or debit cards you added for Apple Pay. All your photos, music, contacts and apps will be also deleted. iCloud, iMessage, Game Center, FaceTime and other services will be turned off. Thus, your iPhone will be completely erased and removed from your account, so that the next owner can then activate it for themselves.
Keep in mind that your content won’t be deleted from iCloud when you erase your device.
If you are not using a SIM-card, you should contact your carrier for guidance on transferring service to the new owner. When the new owner of the iPhone turns on the device for the first time, Setup Assistant will offer its services and guide them through the setup process.
If you didn’t follow the steps above before selling or giving away your iPhone, ask the new owner to erase all content and settings as described above. However, if you’re using iCloud and Find My iPhone on the device, you can erase the device remotely by signing in to icloud.com/find, selecting the device, and clicking Erase. When the device has been erased, click Remove from Account. After you erase the device, you’ll need to wait 24 hours before you can activate iMessage on your new device.
Important note: Deleting documents, contacts, reminders, photo streams, or any other iCloud data while signed in to your iCloud account will lead to the removal of all this content from the iCloud servers, as well as from all of your devices that are signed in on iCloud!