0

I'm trying to use UINotifcationFeedbackGenerator in pythonista,

from objc_util import *
feedbackGenerator = ObjCClass('UINotifcationFeedbackGenerator')

feedbackGenerator = feedbackGenerator.alloc().init()
feedbackGenerator.notificationOccurred(0)

but running this causes the app to crash, with the error file saying

called more times than the feedback engine was activated

so searching it up, it seems the feedback Generator isn't tread safe, but using on_main_thread() didn't work either (or i'm just using it wrong). Through strangely enough, adding it to a method called by ui works here

Thanks for your help!

ArandomDev
  • 125
  • 2
  • 10

1 Answers1

0

Maybe a little late ;-), but: You are overwriting feedbackGenerator which will cause the crash:

feedbackGenerator = feedbackGenerator.alloc().init()

Try this:

f = feedbackGenerator.alloc().init()
f.notificationOccurred(0)
skrohmer
  • 13
  • 4