iMessage Apps and Stickers

作者: coderzcj | 来源:发表于2016-07-05 16:50 被阅读280次

一、iMessage Apps

是什么?
专门为Messages写的APP
三种内容类型:

  • stickers
  • Interactive Messages
  • other - photos, videos, text, links, etc.

二、Messages App Store

可以干什么?

  • 消息内嵌message app -- 引导下载
    inline.png
  • iOS app类似功能 -- app内购Apple Pay相机

三、创建 iMessage Apps

Messages Framework.png

建立在app extension 之上。

不同点:可以不需要container app

有container app : 两个图标 - Home 和 Messages App Store

没有container app :一个图标 - Messages App Store

四、Stickers

可以当正式的消息。还可以粘在其他消息上

本质 -- 图片(动态或静态)

支持格式:PNG, APNG, JPEG, GIF
动画格式:APNG, GIF
最大文件大小:500 KB

官方推荐格式:PNG, APNG(支持透明度,Xcode 优化)

五、创建 Sticker Apps

  1. 只使用assets -- Sticker Pack application 模板

    • 用APNG创建动图
    • 改变cell大小 - small, medium, large
      Sticker Sizes.png
  2. 自定义sticker -- 使用Messages application 模板

好处:

  • 自定义UI
  • 动态创建sticker
  • 使用相机
  • app内购

层级关系:

custom.png

自定义cell:

custom cell.png

呈现样式:

Presentation Styles.png

六、Interactive Messages

  1. Messages API Overview
  • MSMessagesAppViewController
  • MSConversation
  • MSMessage - MSSession, MSMessageTemplateLayout
  1. Extension Lifecycle


    BecomeActive.png
    resigning active.png
  2. Compose a Message


    compose a message.png
    layout.png
  3. Send a Message
    let conversation = self.activeConversation
    conversation?.insert(message) { error in
    // TODO: Check for an error
    })

     conversation?.insertText("Example text”) { error in
     // TODO: Check for an error
     }
    
     conversation?.insertAttachment(resourceURL, withAlternateFilename: nil) { error in
       // TODO: Check for an error
     }
    
     conversation?.insert(sticker) { error in
       // TODO: Check for an error
     }
    
  4. Presentation Style


    presentation style.png
  5. Replying to a Message

  • Extension is inactive


    inactive.png
  • Extension is active


    active.png
  • Session Messages

        let conversation = self.activeConversation
        let session = conversation?.selectedMessage?.session
        let message = MSMessage(session: session)
    
        conversation?.insert(message) { error in
           // TODO: Check for an error
        }
    

参考资料

  1. iMessage Apps and Stickers, Part 1
  2. iMessage Apps and Stickers, Part 2
  3. iOS 10 Screencast: iMessage Sticker Packs
  4. iOS 10 Screencast: Dynamic Sticker Packs in iMessage Apps

相关文章

网友评论

    本文标题:iMessage Apps and Stickers

    本文链接:https://www.haomeiwen.com/subject/buihjttx.html