In an MSStickerBrowserViewController on iOS 10, how can I tell which sticker a user selected?
Asked Answered
K

1

6

I have a subclass of MSStickerBrowserViewController that contains a MSStickerBrowserView with a couple dozen MSStickers. For analytics, we're trying to track which stickers are the most popular in the sticker app. Is there any way to tell which MSSticker was selected by the user?

Kei answered 20/9, 2016 at 20:10 Comment(0)
E
5

There are no delegate methods to tell us that information, unfortunately. I got around this by making my own UICollectionView of MSStickerViews, then adding tap and long press gesture recognizers to the sticker views.

Make sure the gesture's shouldRecognizeSimultaneouslyWith delegate method returns true so they don't get in the way.

To track whether a sticker is actually sent vs. selected takes a bit more work. Tapping and sending a sticker is pretty straightforward to track - the MSMessagesAppViewController methods didStartSending and didCancelSending can tell you if a message was sent or discarded from the input view.

Tracking the peeled and applied sticker analytics is trickier. Applying a sticker to a previous message in the conversation doesn't trigger any of those methods. Best I've come up with so far is to track where the long press ended and make an educated guess as to whether or not the sticker had been sent or cancelled.

Esmeralda answered 26/9, 2016 at 17:26 Comment(2)
Hey - I am trying to do the same thing and have implemented a custom class attempting to do what you suggested but cant display my sticker views, only stickers.. can you help me out please? My question is #39760509Elle
@BJHStudios do you know how to send stickerview in message programatically, i have written some code to send via insert message but at same time auto sending of msstickerview also triggered so it sometime auto insert call and some time my overrided insert called.let me know if you have some example to sort out this type issue.Sands

© 2022 - 2024 — McMap. All rights reserved.