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

272
Visualizações
How to know if user shared my app or not?

My app is all about getting points and winning money, and what I need to do is let the user share my app then give him some points.

The problem is that I don't know how to detect if the user truly shared the app or not

I'm using the following code:

func shareTapped(){
    let text = "example"
    let url = URL(string: "example.com")
    let image = UIImage(named: "example_image")
    let shareViewController = UIActivityViewController(activityItems: [text, image!, url!] ,applicationActivities: nil)
    self.present(shareViewController, animated: true, completion: {() in
        print("done")
    })
}

The sharing method is working perfectly, but I was wondering if there is any delegate we can call in this situation.

Thanks.

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

0

So there is 2 scenarios where user can cancel share.

One is when UIActivityViewController present then there is a cancel button on UIActivityViewController from where user can cancel it and yes you can detect it with method

shareViewController.completionWithItemsHandler = { activity, completed, items, error in

}

In above method completed will be false if user canceled from UIActivityViewController cancel button. and it will return true if user share successfully but here comes second case with it.

So for second case suppose user want to share via watsapp and click on watsapp icon from UIActivityViewController and watsapp user list appear.

But there is a cancel button on that screen from where user can cancel sharing but still you will get completed flag true so there is no way you can detect if user click on cancel button from watsapp user list.

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