In the latest struggle for an American company to navigate the tricky waters of doing business in China, Apple CEO Tim Cook defended his company’s decision to pull a map app that Hong Kong protesters had used to track police. In a memo to employees on Thursday, Cook said Apple removed HKmap.live from its App Store Thursday, because it had been used in ways that “endanger law enforcement and residents in Hong Kong.” The memo was anonymously posted on Pastebin, a website that allows people to post items without revealing their identities. The text was confirmed by a source with knowledge of the memo. Hong Kong has been rocked by several months of protests from anti-government demonstrators. Cook told employees in the memo that the decision to scrap the app wasn’t easy, but Apple received “credible information” from Hong Kong officials and users of the app that HKmap.live was being “used maliciously.” Some protestors were violently targeting people and property where police weren’t present, Cook said, noting the App Store bans apps that can be used for personal harm. He also noted the app violated Hong Kong law. Apple “thoroughly reviewed” the situation before making the decision, Cook said. The app used various emoji to communicate what was happening across Hong Kong: A dog marked where police officers were present; a police car showed where police vehicles were located; and a camera marked the location of a livestream. John Gruber, a widely respected tech blogger and Apple observer, criticized the memo. He wrote on Twitter that Cook’s letter was “both sad and startling” and dismantled the response on his website, questioning Cook’s evidence for his claims. In a statement, Apple\n \n (AAPL) said Thursday the app had been used to target and “ambush” police and threaten public safety. “Criminals have used it to victimize residents in areas where they know there is no law enforcement,” Apple said in an emailed response to CNN Business. Apple declined to further comment. Google\n \n (GOOG) similarly pulled a role-playing game based on the Hong Kong protests from its app store on Thursday. The removal of the app was “not in response to a government request but because the app violated the Play Store’s policies,” a Google\n \n (GOOG) spokesperson said. – CNN Business’ Sherisse Pham and Laura He contributed to this report.