2

I want to create a customized UIView class (a static lib) for some app developers. I have created CMMotionManager instance in my code. I've found that if an app developer also creates the CMMotionManager instance in his code, one of our CMMotionManager instance will fail to handle the gyro/accelerometer values. I realize that the UIWebview can get these values (e.g. javascript code: window.ondevicemotion = function(e) {...}) while the app is getting them, I think there might be a way to avoid this conflict. Any ideas about how to avoid this conflict?

1 Answer 1

2

As with the CLLocation manager you should only implement one instance of CMMotionManager per app, I would recommend creating a singleton class and accessing your CMMotionManager from there, see this post

CMMotionManager is a global resource? What does this means?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.