In MSStickerBrowserViewController on iOS 10, how can I determine which sticker a user has selected?

I have a subclass of MSStickerBrowserViewController that contains an MSStickerBrowserView with dozens of MSStickers. For analytics, we are trying to track which stickers are the most popular stickers in the app. Is there any way to find out which MSSticker was selected by the user?

+6
source share
1 answer

There are no delegate methods to tell us this information, unfortunately. I got around this by creating my own UICollectionView from MSStickerViews, and then add a tap and long gesture recognizers when I click on the stickers.

Make sure the gesture should RecognizeSimultaneousWith the delegate method returns true so that they do not interfere.

To track whether a sticker is actually sent against the selected one, a bit more work is required. Clicking and sending stickers is pretty easy to track - the MSMessagesAppViewController didStartSending and didCancelSending methods can tell you if a message was sent or dropped from the input view.

Tracking analyzed and applied sticker analytics is more complicated. Applying a sticker to a previous message in a conversation does not call either of these methods. So far, the best I've come up with is to keep track of where the long press ended and give a reasonable guess as to whether the sticker was sent or canceled.

+5
source

All Articles