[英]How can I detect which user is the sender of a message from an iOS iMessage extension?
I recently started work on my iMessage extension for my app.我最近开始为我的应用程序开发 iMessage 扩展程序。
If one user sends the message and the other will receive it, how can I receive data from the user who sent the message and change my UI accordingly?如果一个用户发送消息而另一个用户将收到它,我如何从发送消息的用户那里接收数据并相应地更改我的 UI? The data is only a string.
数据只是一个字符串。 I am not sure how to to detect if the
activeMessage
was from the sender or the receiver.我不确定如何检测
activeMessage
是来自发送者还是接收者。
A MSMessage
has a property var senderParticipantIdentifier: UUID
that will give you the UUID of message author.MSMessage
有一个属性var senderParticipantIdentifier: UUID
,它将为您提供消息作者的 UUID。 That information can be compared to the MSConversation
information.该信息可以与
MSConversation
信息进行比较。 The MSConversation
has properties for var localParticipantIdentifier: UUID
MSConversation
具有var localParticipantIdentifier: UUID
A UUID that identifies the user on this device.
标识此设备上的用户的 UUID。
and var remoteParticipantIdentifiers: [UUID]
和
var remoteParticipantIdentifiers: [UUID]
An array of UUIDs representing the remote participants in this conversation.
代表此对话中远程参与者的 UUID 数组。
There is a great deal of available info in the Docs for the Messages framework .消息框架的文档中有大量可用信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.