If you enter the password wrong six times in a row, you will be locked our a see a message saying that your device is disabled. This post will show you three different ways to deal with this sort of situation. Please choose accordingly the right way for you. They also apply to the situation where you forgot your password and cannot log into your device.
If you are signed to iCloud and Find My iPhone is enabled
If you are synced with iTunes
If you don’t use iCloud and you can’t sync or connect with iTunes
Erase your device with iCloud
If you have set up Find My iPhone on your iOS device, you can use iCloud to erase and restore it.
1) Go to iCloud/Find from another device. Type in your Apple ID and password to log in.
2) Choose the device from the list of choice, and then choose Erase iPhone option to erase your device and its password.
3) Now you can choose either Restore from a backup or set up as new.
Erase your device with iTunes
If you are synced with iTunes, you can restore your device.
1) Connect your iPhone to the computer you synced with. Make sure that your iPhone is unlocked.
2) Open iTunes. Make sure that you have the latest version of iTunes. If asked for a password, try another computer you have synced with, or use recovery mode.
3) You will see the little phone icon on the left side of the iTunes pane. Click this icon. If you don’t see the icon, please refer to this post here to fix it first.
4) Scroll down a little to locate the Backups section. Then choose This computer option, and please make sure that the Encrypt iPhone backup option is ticked. Then press the Back Up Now button on the right side of the pane.
Wait for a while for the process to finish.
5) Please be patient and only proceed until the backup complete. When the backup complete, click Restore iPhone… option.
6) You will need to go through the following set up options while restoring your iOS device.
7) When you reach the following screen, tap Restore from iTunes backup.
8) On iTunes on your computer, select Restore Backup….
9) Choose your most recent backup from the list and choose Restore.
Erase your device with recovery mode
If you have never synced with iTunes or set up Find My iPhone in iCloud, you will need to use recovery mode to restore your device. This will erase the device and its password.
1) Connect your iOS device to your computer. Then open iTunes on your computer if it does not open automatically. Still, make sure the iTunes on your computer is the latest version.
2) When your device is connected, force restart it.
If you are using iPhone 6s and earlier, press and hold the Sleep/Wake button and the Home button at the same time. Don’t release them until you see the Apple logo. Then keep holding both of the buttons until you see the recovery mode screen.
If you are using iPhone 7 or iPhone 7 Plus, press and hold the Sleep/Wake and volume down buttons at the same time. Don’t release until you see the Apple logo. Then keep holding both of the buttons until you see the recovery mode screen.
3) When you see the following notification on your computer screen, choose Restore. iTunes will now download the software for your device. You might need to repeat step 2) and 3) for a couple of times if it takes more than 15 minutes to finish.
4) Wait with patience for the process to finish, then you can set up and use your device.