The Manhattan district attorney to Apple: Stop acting like teenagers.

Cyrus Vance, standing with Police Commissioner Bill Bratton on Thursday in police headquarters, said companies such as Apple and Google need to be more helpful to law enforcement. The statement came in the wake of a court ruling ordering Apple to access the encrypted iPhone of one of the San Bernardino shooters, and the technology company’s open letter objecting to the demand.

“Just in my opinion, they’re acting like teenagers saying no one can tell me what to do,” Vance said. “Even when we can, in instance after instance, show that their decisions are affecting the safety and path to justice for victims throughout our country in cases ranging from terrorism to domestic violence.”

But Bratton said he doesn’t need to hold a master key.

“We’d like to effectively go back to a situation, even if it’s controlled by Apple, that they can respond to a lawful court order, a search warrant,” he said. “Something that they conveniently now don’t have to respond to because, basically [they say] ‘we know nothing, we don’t know how to get in there.’ For what purpose other than a competitive edge against the company they compete against?”

A representative for Apple did not immediately respond to a request for comment. In his open letter this week, Apple’s CEO Tim Cook said the company’s stance was to protect the privacy of its law-abiding users. “The government suggests this tool could only be used once, on one phone,” he wrote. “But that’s simply not true. Once created, the technique could be used over and over again, on any number of devices.”

Before Apple upgraded its software to iOS 8 in September 2014, Vance said, the company would cooperate — though slowly — with court-ordered search warrants.

“Is it a public privacy issue? Or is it a marketing issue?” he said. “What we’re asking for is to have Apple do what it did through it’s use of iOS 7, which is to maintain a digital key that we don’t have access to, and the government doesn’t have access to.”

Holding up a phone that belonged to an associate of the man who shot two officers earlier this month in a Bronx housing project, Bratton said this showed a lack of “responsibility” on Apple’s part. “Despite having a court order, we cannot access this iPhone5” because it has been upgraded to iOS 8, Bratton said. “Impeding that case going forward is our inability to get into this device.”

Vance said the DA’s office started tracking devices in its own cyber lab after Apple’s software started locking phones in 2014.

“It is very difficult to explain to a victim of a crime, whether it is an assault, a sexual charge, or a financial charge, that we cannot get the evidence that may identify the individual who committed the crime because a cellphone company — a designer — has decided they know better,” Vance said.