Iphone 4 says no sim inserted?

I have bought a new sim for an iphone that my dad is giving me. It is the iphone 4 and it was previously on contract, there's nothing wrong with the sim as it works perfectly in my other phone. My dads sim works perfectly in the iphone. My sim works for about 30 seconds then says no sim when you first turn the phone on. Is there a way to fix this?

Added (1). It is a t-mobile iphone and the sim is on t-mobile

Added (2). I have fixed it! Thanks for suggestions but i found that putting tape on the top of the sim card made it work

You need to unlock it

T mobile doesn't sell the iphone, its an att iphone unlocked for tmobile… You might have updated the firmware and lost the unlock.