首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何检查是否发送或接收了MSMessage?

如何检查是否发送或接收了MSMessage?
EN

Stack Overflow用户
提问于 2016-09-20 07:06:29
回答 1查看 336关注 0票数 2

我正在制作一个基于iMessage扩展的回合制游戏。

我想要能够检查谁(发送者或接收者)在iMessage被点击时打开它。例如:

如果发件人打开它:

代码语言:javascript
复制
remind them that it is the other persons turn

如果接收者打开它:

代码语言:javascript
复制
allow them to take their turn
EN

回答 1

Stack Overflow用户

发布于 2016-09-20 07:07:39

您希望根据MSMessage的localParticipantIdentifier检查所选MSConversation的MSConversation。

以下是当MSMessage将变为活动状态时如何执行此操作的示例:

代码语言:javascript
复制
override func willBecomeActive(with conversation: MSConversation) {
   if let selectedMessage = conversation.selectedMessage {
        if conversation.localParticipantIdentifier == selectedMessage.senderParticipantIdentifier {
            // you sent this iMessage
        } else {
            // you recieved this iMessage
        }
    }
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39583382

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档