当我在 CDVLocation.m 文件中使用 phonegap 2.4 创建新的项目框架时出现错误。我得到的错误是
if ([cdvViewController supportsOrientation:currentOrientation])
从枚举类型“UIDeviceOrientation”(又名“枚举 UIDeviceOrientation”)到不同枚举类型“UIInterfaceOrientation”(又名“枚举 UIInterfaceOrientation”)的隐式转换
我不是 100% 确定这里发生了什么,因为我不知道 OBJ -C,有什么想法吗?
问问题
939 次
1 回答
1
currentOrientation
是UIDeviceOrientation
具有更多值的类型UIInterfaceOrientation
由于该方法需要 aUIInterfaceOrientation
而不是 aUIDeviceOrientation
代替:
和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 回答