Getting names of participants MSConversation
Asked Answered
H

1

1

I am developing an iMessage app where I need to get the names of participants of a conversation. In the WWDC Session iMessage Apps and Stickers, Part 2 (link), they are explaining how to do that in Swift via String interpolation :

layout.caption = "$\(conversation.localParticipantIdentifier.uuidString) likes Sprinkles!"

The thing is I want to do the same in Objective-C and I can't find any documentation on how to perform string interpolation in Objective-C or how to achieve showing the name of the participants.

I have tried

[layout setCaption:[NSString stringWithFormat:@"$\(%@)",conversation.localParticipantIdentifier.UUIDString]];

but it is showing the entire UUID instead of the participant name. There must be a Objective-C way!

Am I doing something wrong?

Thanks for your help.

Halette answered 14/8, 2016 at 16:27 Comment(0)
H
1

OK. I found the solution.

I just needed to add a dollar sign before the UUID.

[layout setCaption:[NSString stringWithFormat:@"$%@",self.activeConversation.localParticipantIdentifier.UUIDString]]; 
Halette answered 14/8, 2016 at 16:32 Comment(1)
This is theory because in practice this gives wrong results and don't identify the local participant... not on simulator and on the real device this produces a "mobile user" result... come on Apple!Nelson

© 2022 - 2024 — McMap. All rights reserved.