Notificações no iOS 10

Notificações no iOS 10

Chegou a hora de olhar com um pouco mais de carinho para as notificações do seu app. Vamos aproveitar as novidades introduzidas no iOS 10 para engajar cada vez mais os nossos usuários e entregar-lhes uma melhor experiência com as Rich Notifications.

Fabricio Serralvo

March 22, 2017

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

71 slides
  1. override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) ->

    Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { if let pushContent = PushRepresentation(withUserInfo: bestAttemptContent.userInfo) { downloadAttachment(url: pushContent.contentURL, completion: { (completion) in contentHandler(bestAttemptContent) }) } } }
  2. func downloadAttachment(url: URL, completion: @escaping (Bool) -> Void) { (…)


    do { let attachment = try UNNotificationAttachment(identifier: "attachment", url: attachmentURL, options: nil) bestAttemptContent?.attachments = [attachment] completion(true) } catch { completion(false) } (…) }
  3. { "aps": { "alert": { "title": "Os chineses vem aí",

    "body": "Grandes jogadores podem deixar o país: Denis e Rodriguinho são os alvos", "url": “https://domain.com/files/photo.jpg" }, "mutable-content": 1, "content-available": 1 } }
  4. func didReceive(_ notification: UNNotification) { setupInterface(notification: notification) } func setupInterface(notification:

    UNNotification) { let player = Player.init(withRepresentation: […] ) let teamFrom = Team.init(withRepresentation: […]) let teamTo = Team.init(withRepresentation: […]) playerName?.text = player?.name teamFromName?.text = teamFrom?.name teamToName?.text = teamTo?.name
 
 (…)
 
 }
  5. { "aps": { "alert": { "title": “Novidades Mundo da Bola",

    "subtitle": "Janela de Transferências”, "body": “Hora de conferir quem chega e quem sai do seu clube do ❤" } } }

More Decks by Fabricio Serralvo

Other Decks in Programming