1

I am creating this messages extension that is a game.

When I receive a conversation on didBecomeActiveWithConversation I grab my UUID and the opponent's UUID, for example:

myUUID = [conversation.localParticipantIdentifier UUIDString];
opponentUUID = [[conversation.remoteParticipantIdentifiers firstObject] UUIDString];

at this point if I print this I get something like

myUUID = 3A00236E-606E-41BE-BD11-97658AF13434
opponentUUID = 794DC7EB-E0AF-46CD-9BF0-5B6D39CC6773

Then I make my move in the game and send to the opponent.

On the simulator I switch from "Kate" to "John Appleseed".

When the method didBecomeActiveWithConversation triggers again, now for the other user, I grab both UUID again. This is the result:

myUUID = 3A00236E-606E-41BE-BD11-97658AF13434
opponentUUID = B4621E05-4407-443E-9526-C8F0C82753D6

What? myUUID is the same as before and my opponentUUID is completely different?? By switching users on message I was expecting to see the entries reverted. How can that be? Bug?

Duck
  • 34,902
  • 47
  • 248
  • 470

1 Answers1

2

Apple doesn't like issuing numbers that can be used to identify users beyond what is strictly necessary. In this case, the localParticipantIdentifier property is unique to each device (so person A has different identifiers on each device they are talking with) and each app install (so two different apps will see two different identifiers).

In fact, if the user deletes and reinstalls your extension, the identifier will be changed – just like identifierForVendor on UIDevice.

From the docs:

This UUID is scoped to this device. It remains stable as long as the extension is enabled. If the extension is disabled and reenabled, or if the containing app is removed and reinstalled, the UUID for the local participant changes.

This particular case is complicated by the fact that you're using the simulator, which is rigged by Apple to look like two accounts even though it's one device. I suspect that when you run the same code on two real devices you'll find two completely different numbers on both sides.

It's worth adding that there are several open radars for Messages identifiers, not least this one, so you might be right that it's a bug.

TwoStraws
  • 12,862
  • 3
  • 57
  • 71
  • ok, I understand privacy but this is insane. The user is playing a game with the other side and is expected to at least exchange the IDS with that person. If you talk to another person on messages the person on the other side knows your name/nick/messages identification so it is nonsense to block the other side from knowing your UUID and because you have to press send to send the message makes spam impossible, unless you develop a robot with a mechanical hand to tap messages to a huge list and press send every time... thanks anyway! – Duck Sep 01 '16 at 19:33
  • what is most frightful about all these bugs is that Apple released iOS 10 and Xcode 8 Golden Master and they still contain this bug, what means, they will probably ship one of the main iOS 10 functionalities broken, what is typical from Apple, as we have seen several times before. Very sad. – Duck Sep 12 '16 at 13:41
  • Did you manage to find a workaround to this? Using something else rather than UUID? It is really weird that they did that. Thanks – RJiryes Sep 27 '16 at 17:32
  • I'm having the same issue in the simulator, ```myUUID``` (localParticipantIdentifier) is the same for both "Kate" and "John Appleseed", this is a major bug in the simulator and I just can't believe they shipped Xcode with this issue. It is just impossible to create a game with player turns with this bug using the simulator. I also tried generating an UUID and then storing it in UserDefaults, but UserDefaults is also shared between "Kate" and "John Appleseed". Any other workaround? – fernandospr Oct 30 '16 at 21:13