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.

Sudo
  • 991
  • 9
  • 24

1 Answers1

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]]; 
Sudo
  • 991
  • 9
  • 24
  • 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! – Duck Sep 14 '16 at 15:46