Trying to figure out who the bad guy is in a movie? Look for the character that hasn't touched an iPhone.

Rian Johnson, the writer and director of "Knives Out," revealed that Apple will permit film productions to use its products onscreen, but with one very big caveat — villains can't have an iPhone on camera.

"I don't know if I should say this or not," Johnson said in a Vanity Fair video posted Tuesday where he breaks down a scene from his hit murder mystery. "Not 'cause it's lascivious or something, but because it's gonna screw me on the next mystery movie that I write. But forget it, I'll say it, it's very interesting."

"Apple, they let you use iPhones in movies, but, and this is very pivotal, if you're ever watching a mystery movie, bad guys cannot have iPhones on camera," he said. "Every single filmmaker who has a bad guy in their movie that's supposed to be a secret wants to murder me right now."

It makes sense that companies like Apple don't want to have their products promoted in the hands of movie antagonists, in the same way that soda companies don't want audiences to see cans of their famous brands tossed into trash bins on the big screen.

Representatives for Apple did not immediately respond to CNBC's request for comment.

If you haven't seen "Knives Out," now would be a good time to stop reading if you don't want the ending spoiled.

Johnson pointed out the Apple caveat while dissecting a tense scene between all of the Thrombey family members ahead of the reading of the late Harlan Thrombey's will. A cellphone then becomes a spoiler. During the scene, Jamie Lee Curtis' character Linda Drysdale can be seen with an iPhone, prompting Johnson to reveal the behind-the-scenes secret.

When rewatching the film, you can see several other characters who are suspects carry or use iPhones. However, the ultimate bad guy in the film, Ransom, played by Chris Evans, does not have an iPhone in the film.

Johnson's whodunit has garnered more than $300 million at the global box office since its November release, a sizable return on a $40 million budget. The film became available on 4K, Blu-Ray and DVD on Tuesday.

Johnson is currently working on a sequel to the film.