简体   繁体   English

如何检测哪个用户是来自 iOS iMessage 扩展的消息的发件人?

[英]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.

相关问题 如何识别 iMessage 扩展中的消息是来自发送者还是接收者? - How to identify that message in iMessage extension is from sender or receiver? Swift 3:iMessage Extension检测用户点击Message并检测手动幻灯片 - Swift 3: iMessage Extension detect User tap on Message and Detect Manual Slide 如何通过在iMessage中点击“发送”等操作从iOS键盘扩展中检测到文本字段被清除? - How to detect from iOS keyboard extension that a textfield is cleared via actions like hitting “Send” in iMessage? 如果用户向上滚动控制中心,如何从iOS键盘扩展中检测到? - How can I detect from iOS Keyboard extension if user scrolled up the Control Center? 如何加载从iMessage收到的图像? [IOS 7] - How can I load images received from iMessage? [iOS7] 我们如何从iMessage访问消息? - How can we access message from iMessage ? ios iMessage 应用扩展动画 gif 消息 - ios iMessage app extension animated gif message 以编程方式从iMessage扩展中删除消息 - Remove message from an iMessage extension programmatically 如何将大字符串传递给 iMessage 扩展? - How can I pass a large string to an iMessage Extension? 如何通过iOS应用程序通过电子邮件和消息共享字符串? - How can I share a string through email and imessage from my iOS app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM