A passcode ensures that your Apple device stays secure from the hands of miscreants who can misuse your important information and data. But frequently users come across the problem of Apple passcode not working. But you can fix it by given process -
• Connect your Apple device to the computer you have synced
• Open iTunes > click on Restore iPhone
• Select your device > to choose the most recent backup
• You are done!
In case if the iTunes method won’t work then you can restore your Apple device which has passcode problem with iCloud too.
Read more: Apple Id Not Working Update Apple ID Setting