0

CDVLocation.m ファイルで phonegap 2.4 を使用して新しいプロジェクト スケルトンを作成すると、エラーが発生します。私が得ているエラーは
if ([cdvViewController supportsOrientation:currentOrientation])
、列挙型「UIDeviceOrientation」(別名「列挙型UIDeviceOrientation」)から別の列挙型「UIInterfaceOrientation」(別名「列挙型UIInterfaceOrientation」)への暗黙の変換

です。OBJ がわからないので、ここで何が起こっているのか100%わかりません。 -C、何か考えはありますか?

4

1 に答える 1

1

currentOrientationUIDeviceOrientationよりも多くの値を持つタイプですUIInterfaceOrientation

UIInterfaceOrientationメソッドは a の代わりに a を期待するためUIDeviceOrientation

交換:

  • supportsOrientation:currentOrientation
  • supportsOrientation:[[UIApplication sharedApplication] statusBarOrientation]]

CDVLocation.m のメソッドを変更してみてください。

if ([self.locationManager respondsToSelector:@selector(headingOrientation)]) {
    UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
    if (currentOrientation != UIDeviceOrientationUnknown) {
        CDVViewController* cdvViewController = (CDVViewController*)self.viewController;

        //change this line
        if ([cdvViewController supportsOrientation:[[UIApplication sharedApplication] statusBarOrientation]]) {
            self.locationManager.headingOrientation = (CLDeviceOrientation)currentOrientation;
            // FYI UIDeviceOrientation and CLDeviceOrientation enums are currently the same
        }
    }
}
于 2013-03-28T13:23:24.383 に答える