[ 
https://issues.apache.org/jira/browse/CB-2392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13576240#comment-13576240
 ] 

Wouter cx commented on CB-2392:
-------------------------------

I had this issue also. IPhone simulator 6.1, using 2.4.
I had just downloaded PhoneGap 2.4, done the "Getting Started with iOS" 
tutorial.
After starting the simulator I got three errors, of which 2 were easily fixed 
by XCode itself.
After that this warning remained.
I did a little research just an hour ago, found a fix, and then I saw your fix.

I have a comment, I think this is not good practice to cast
UIDeviceOrientation
to
UIInterfaceOrientation

Read this:
http://stackoverflow.com/questions/7015709/xcode-getting-warning-implicit-conversion-from-enumeration-type-uideviceorient

and this:
https://github.com/ricardoquesada/facebook-ios-sdk/commit/c760a38c5357323aab7756e70c745f3dc0d7163d
"I wouldn't consider this a good practice, casting UIInterfaceOrientation to 
UIDeviceOrientation! I would rather see a structural fix."

and this:
http://stackoverflow.com/questions/8413750/implicit-conversion-from-enumeration-type-uiinterfaceorientation-to-different
"bad practice"

and this:
http://stackoverflow.com/questions/2614274/determine-uiinterfaceorientation-on-ipad
(solution)

Also, the definition of supportsOrientation in supportsOrientation.m says 

- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation

I changed it to this on my machine (this works, doesn't give any warnings 
anymore):

- (void)startHeadingWithFilter:(CLLocationDegrees)filter
{
    if ([self.locationManager 
respondsToSelector:@selector(headingOrientation)]) {
        UIInterfaceOrientation currentInterfaceOrientation = [UIApplication 
sharedApplication].statusBarOrientation;
        UIDeviceOrientation currentDeviceOrientation = [[UIDevice 
currentDevice] orientation];
        CDVViewController* cdvViewController = 
(CDVViewController*)self.viewController;

            if([cdvViewController 
supportsOrientation:currentInterfaceOrientation ]) {
                self.locationManager.headingOrientation = (CLDeviceOrientation) 
currentDeviceOrientation;
                // FYI UIDeviceOrientation and CLDeviceOrientation enums are 
currently the same
            }
    }
    self.locationManager.headingFilter = filter;
    [self.locationManager startUpdatingHeading];
    self.headingData.headingStatus = HEADINGSTARTING;
}

What do you think?
I'm still brand new to this stuff, so I hope I'm right.

                
> Xcode 4.6 warning in CDVLocation
> --------------------------------
>
>                 Key: CB-2392
>                 URL: https://issues.apache.org/jira/browse/CB-2392
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>            Priority: Minor
>             Fix For: 2.5.0
>
>
> See: https://groups.google.com/d/topic/phonegap/vMwiOislx9Q/discussion
> Shows up when running on device.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to