Compiler Warning... Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'?

11,770

Solution 1

Try changing

_orientation = [UIApplication sharedApplication].statusBarOrientation;

to

 _orientation = (UIDeviceOrientation)[UIApplication sharedApplication].statusBarOrientation;

Solution 2

How about this?

UIDeviceOrientation _orientation = [[UIDevice currentDevice] orientation];
Share:
11,770

Related videos on Youtube

SimplyKiwi
Author by

SimplyKiwi

Mobile Tech Lead at SimplyKiwi. Senior iOS Engineer at Rose Digital.

Updated on October 01, 2020

Comments

  • SimplyKiwi
    SimplyKiwi over 3 years

    In Xcode I get a warning in the following line for FBConnect:

    _orientation = [UIApplication sharedApplication].statusBarOrientation;

    This is the full warning:

    Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'
    

    Any ideas how I can fix this?

    Thanks!

  • justinkoh
    justinkoh over 10 years
    statusBarOrientation return UIInterfaceOrientation instead of UIDeviceOrientation. The casting seems incorrect.

Related