Randy Liedtke developed a rather clever prank involving cookies to trick local police officers, but it ended up backfiring and earning him a ticket.

The L.A. comedian first baked a batch of cookies that looked like iPhones, showing off his creations on Twitter and Tumblr. His plan was to pretend to talk into while driving in hopes of getting pulled over, as it is illegal to use a cell phone while driving in California.

When Liedtke did get pulled over, he planned on then taking a bite out of the fake iPhone and asking the officer if cookies were against the law, as he wrote on his Tumblr, but things didn't go exactly as planned. Liedtke live tweeted his entire caper, starting with a police sighting.

"Gonna turn around and see if I can catch up and drive by it. #iphonecookie," he tweeted, later adding, "Took a bite out of the cookie. He was so confused and angry. Told me to hold tight, he is back in his car now."

When the officer returned, Liedtke updated his followers, writing, "Says I have a warrant for unpaid parking tickets? Making me go with him."

"Wasn't worth it. I'm an idiot," the prankster tweeted Wednesday night after the stunt, along with a photo of him looking sad and holding up his ticket. "No more iPhone Cookies."