This makes obvious sense if you think about it for a moment. The police plan a raid on someone's home. They don’t know if they will be allowed in. They need to make sure that the evidence will not be destroyed while they stand on the doorstep. They obtain a search warrant in advance. When the door is opened, they ask if they can search the premises. Either consent is granted, in which case there is no problem. Or it is refused — and they immediately produce the warrant. That must happen every day.