编译器警告...从枚举类型'UIInterfaceOrientation'到不同的枚举类型'UIDeviceOrientation'的隐式转换?

时间:2011-06-12 05:27:52

标签: objective-c compiler-warnings

在Xcode中,我在FBConnect的以下行中收到警告:

_orientation = [UIApplication sharedApplication].statusBarOrientation;

这是完整的警告:

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

我有什么想法可以解决这个问题吗?

谢谢!

2 个答案:

答案 0 :(得分:39)

尝试更改

_orientation = [UIApplication sharedApplication].statusBarOrientation;

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

答案 1 :(得分:2)

这个怎么样?

UIDeviceOrientation _orientation = [[UIDevice currentDevice] orientation];