Just thought I'd share a quick bit of info. I recently bought my daughter a second hand iPhone as her old android phone was playing up. Once I received it, I noticed that the seller had left a working PAYG sim in it. "No matter" I thought, and continued to set it up with a new Applie ID. When ready, I placed my daughters old sim in the phone - and then got the dreaded "invalid sim / no service" messages.
I tried everything - reseating, the "tape" method, blowing the dust out - nothing worked. Then my daughter-in-law saw a post online about connecting the iPhone to iTunes so it could reset the ID - at that point I realised the problem. The new Apple ID had "cloud locked" the phone, which ties the phone into the SIM, so it only work with that SIM. Once I knew this, I connected the iPhone to iTunes, which then reset the Apple ID on the phone - I could then re-enter the ID which re-associated the new SIM with the iPhone allowing it to work