アプリでコアモーションを使用しています。このコードは正常に動作します:
motionManager = [[CMMotionManager alloc] init];
int a = [CMMotionManager availableAttitudeReferenceFrames];
このコードは EXC_BAD_ACCESS でクラッシュし、行の上に次のメモが表示されます。
int a = [CMMotionManager availableAttitudeReferenceFrames];
motionManager = [[CMMotionManager alloc] init];
ステートメントの最初の順序を使用することで問題を回避できますが、availableAttitudeReferenceFrames が次のように定義されているためです。
+ (NSUInteger)availableAttitudeReferenceFrames
クラスをインスタンス化する前にプロパティにアクセスできるはずです。なぜこれが機能しないのですか?