Completion did not work When I flagged messages

I want to flag massages by using messageFlagger.flag. However, The completion does not work at all.

Hi @janrai456,
AmityMessageFlagger needs a variable for holding its reference.
You need to declare it in a class scope. Otherwise, the reference will be eliminated before the completion block gets triggered.

For example:

class ABC: {
   var flagger: AmityMessageFlagger?

   func reportMessage() {
      flagger = AmityMessageFlagger(...)
   }
}
1 Like