Example: I have this block, and I want to update a label on the screen:
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMDeviceMotion *deviceMotion, NSError *error) {
CMAcceleration *userAcceleration = deviceMotion.userAcceleration;
self.labelX.text = [NSNumber numberWithFormat:@"%f", userAcceleration.x];
}];
I fear this won’t work well. Threading-problems, etc? Suggestions?
If you have reference to the label you can use performselectoronmainthread method to update it on the main thread. Yes the UI is not thread safe.