I'm getting an error when I create a new project skeleton using phonegap 2.4 in my CDVLocation.m file. The error I'm getting is
if ([cdvViewController supportsOrientation:currentOrientation])
Implicit conversion from enumeration type "UIDeviceOrientation"(aka "enum UIDeviceOrientation") to different enumeration type "UIInterfaceOrientation" (aka "enum UIInterfaceOrientation")
Im not 100% sure whats going on here since I dont know OBJ-C, any idea?
Asked
Active
Viewed 946 times
0

mhartington
- 6,905
- 4
- 40
- 75
1 Answers
1
currentOrientation
is of type UIDeviceOrientation
which has more values thanUIInterfaceOrientation
Since the method expects a UIInterfaceOrientation
instead of a UIDeviceOrientation
Replace:
withsupportsOrientation:currentOrientation
supportsOrientation:[[UIApplication sharedApplication] statusBarOrientation]]
Try changing the method in 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
}
}
}

jermel
- 2,326
- 21
- 19
`- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation { return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]]; }` – mhartington Mar 28 '13 at 13:11