The iPhone has fairly decent parental controls built in: you access most of these via Settings > General > Restrictions, from where you can choose which apps, services and actions (such as installing apps or paying for in-app purchases) you want to allow. To bypass these restrictions the user must enter a passcode - but what happens if you forget the passcode?

Fortunately it's possible under most circumstances to bypass the restriction passcode by restoring your iPhone in iTunes. (Simply choosing to 'Erase All Content and Settings' on the iPhone itself won't help - you'll still have to enter the restrictions passcode when you restart.) You will lose your data and restoring from a backup is tricky, but there are some third-party backup tools that can help here.

But first let's look at a sneaky trick which will help you to guess the passcode.

How to guess the passcode (and how many guesses do you get?)

The restrictions passcode works similarly to the main device-unlock passcode: if you get it wrong too many times, the system starts imposing delays. Get it wrong six times and the delay is just one minute; after seven times it's five minutes; then 15 minutes, and then an hour each time you get the code wrong.

Unlike the main passcode, however, the restrictions passcode doesn't offer the option to have your iPhone erase itself after 11 failed attempts, and since (depending on how severe the restrictions you imposed) you've probably got access to most of the system and can fiddle with the system, it's possible to work around this and get a decent number of guesses without waiting too long.

After you get it wrong and iOS imposes a time delay, go back to Settings > General and then select Date & Time. Turn off 'Set Automatically' and manually change the time forward so it's after the time when your delay will elapse. It sounds mad but we've tested this and (as of iOS 10.3.2) it works. Don't forget to reset the time when you're finished!

Clearly you don't want to be trying all 10,000 combinations for a four-digit passcode, but if you're in one of those situations where you're sure there's a 4, a 6 and a 9 and a 7 but you're not sure in what order, or you know it's a birthday but you can't remember who, then this is a great way of quickly burning through a few dozen guesses.

Restore from a backup in iTunes

This method will get around a restrictions passcode if you've got Find My iPhone disabled.

(Open the Settings app then tap your Apple ID name card at the top, then iCloud, and tap to turn off Find My iPhone. You'll need to enter your Apple ID password at this point, so if you've not got that password either you'll need to find an alternative solution.)

We're going to wipe the device, so we'll want to back up beforehand. The problem with doing this in iTunes or iCloud is that the restriction passcode (and other passwords) will be part of the backup that is carried across, and we're in no better position than before.

Have a look for a third-party iPhone backup tool that can selectively back up part of a device's data but not all. One possibility is dr.fone iOS Data Backup & Restore.

Make sure your iPhone is updated to the latest version of iOS, and plug it into your Mac or PC. Open iTunes if it doesn't do so automatically. Click the little iPhone icon to open the device's Summary page, and click Restore iPhone in the top section of the Summary page, then confirm and agree to subsequent Ts & Cs. iTunes will download the latest version of iOS and restore your iPhone from that.

Now you can restore from the selective backup you made earlier.