Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

325
Visualizações
IOS iMessage extension screenshot detection

Please use Swift 4+

NOTE: I am detecting the screenshot while I am within the iMessage extension, not in the standard iMessage view.

Update - I came up with a working solution that checks the photo library during the sensitive information period every .3 seconds or so to check if a new screenshot has been added. If the user does not give permission to the photo library, it won't show them the content until they enable it. However, I am still looking for other creative solutions that don't necessarily involve such a tedious process.

I have an iMessage extension and I am trying to detect screenshots. I have tried every observer I have found online and for some reason it is not registering screenshots.

ViewWillAppear()

UIScreen.main.addObserver(self, forKeyPath: "captured", options: .new, context: nil)

Observer

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
    if (keyPath == "captured") {
        let isCaptured = UIScreen.main.isCaptured
        print(isCaptured)
        screenshot()
        //screenshot() sends a message alerting the message was screens hotted. However, the print statement didn't even run.
    }
}

ViewWillDisappear()

UIScreen.main.removeObserver(self, forKeyPath: "captured", context: nil)

I have also tried the standard default Notification Center

let mainQueue = OperationQueue.main
    NotificationCenter.default.addObserver(forName: UIApplication.userDidTakeScreenshotNotification, object: nil, queue: mainQueue) { notification in
        // executes after screenshot
        print("Screenshotted")
        self.screenshot()
    }

For people who claim it is not possible to detect screenshots within an iMessage extension because it is an extension and not a full app, this developer has been able to successfully do it Working Example

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Perhaps it little bit of overkill, but you can transform your image in DRM protected video and system prevent any screenshots / screen sharing / screen recording of DRM protected videos.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda