Question

I'm using core motion in my app. This code works fine:

motionManager = [[CMMotionManager alloc] init];
int a = [CMMotionManager availableAttitudeReferenceFrames];

This code crashes with EXC_BAD_ACCESS, with this note above the line: THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY_YOU_MUST_EXEC__

int a = [CMMotionManager availableAttitudeReferenceFrames];
motionManager = [[CMMotionManager alloc] init];

I can get around the problem by using the first ordering of statements, but since availableAttitudeReferenceFrames is defined as

+ (NSUInteger)availableAttitudeReferenceFrames

it seems like I should be able to access the property before instantiating a class. Why doesn't this work?

Was it helpful?

Solution

That's a rather strange error. You're only supposed to see that if you call fork() and then try to use CoreFoundation. Since you cannot fork() on iOS, then you should never see this error.

Can you reproduce this issue in a very small sample project? If you can, you should file a bug report with Apple and attach the sample project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top