A few things:
- If you turn off your iPhone, it won’t let you unlock with a fingerprint. You would then have to be forced to give up your pin.
- From what I heard from a few immigration attorneys (and this article), if you refuse to unlock your device and you’re a US citizen, they may confiscate your phone and send it for forensic analysis, but they likely won’t detain you for more than several hours. You may not get your device back for weeks or months (or possibly ever if they “lose” it).
- If they do detain you, however, it would suck because they will cuff you, put you on a bus, send you to a detention center, and then let you call a family member to get an attorney once you’re there. Then, in order to get in front of a judge to dismiss the case you have to get on the docket which could take days or sometimes weeks depending on the time of year (e.g. around holidays) and where you are (e.g. places where there are fewer federal judges available). This apparently happens all the time with US citizens who don’t have proper travel documents (lost / expired passport, etc).
- If you let someone else reset your passcode, you couldn’t unlock it if you wanted to. One could let a friend, colleague, or family member reset the pin/password while abroad and mail you the code. The government would need a search warrant to get the code from your house (if they even knew about it). Though, this may piss CBP off and make them want to confiscate your device or detain you even more. :-)