Did your iPhone get locked and you do not remember the password? Here is what you need to do.
According to Apple’s support page, if you can’t remember your passcode, you need to use a computer to put your iPhone in recovery mode. However, it is important to note that this process deletes your data and settings, including your passcode, but it also gives you access to set up your iPhone again. After you erase your iPhone, you can restore your data and settings from backup. And if you did not take the backup earlier, you can set up your iPhone as a new device and then download any data that you have in iCloud. Here is how to get your iPhone into recovery mode so you can erase it and set it up again.
How to put iPhone recovery mode on
Make sure that you have a computer (Mac or PC): If you are using a PC, make sure that it has Windows 8 or later, and that iTunes is installed. You also need the cable that came with your iPhone, or another compatible cable, to connect your iPhone to the computer. If you do not have a computer and you cannot borrow one, you need to go to an Apple Retail Store or Apple Authorized Service Provider for help.
Turn off your iPhone: Unplug your iPhone from the computer if it is connected. Turn off your iPhone using the method for your iPhone model.
Put your iPhone in recovery mode: If you have an iPhone X or later, iPhone SE (2nd generation), iPhone 8, and iPhone 8 Plus then use the Side button. iPhone 7 and iPhone 7 Plus use the Volume down button. iPhone SE (1st generation), and iPhone 6s and earlier use the Home button.
You need to Press and hold the correct button for your iPhone while immediately connecting your iPhone to the computer. Do not let go of the button and keep on holding it until you see the recovery mode screen on your iPhone, then let go. It can be noted here that if you see the passcode screen, you need to turn off your iPhone and start again.
Restore your iPhone: Locate your iPhone in the Finder or in iTunes on the computer that it is connected to. Choose Restore when you see the option to Restore or Update. Your computer downloads software for your iPhone and begins the restore process. If the download takes more than 15 minutes and your device exits the recovery mode screen, let the download finish, then turn off your iPhone and start again.
Wait for the process to finish. Disconnect your iPhone from the computer, then set up and now, you can use your iPhone again.