我正在使用
Xcode 5.0.2并在尝试编译我的目标C代码时收到以下警告:
Implicit conversion from enumeration type ‘enum UIDeviceOrientation’
to different enumeration type ‘UIInterfaceOrientation’ (aka ‘enum
UIInterfaceOrientation’)
警告在viewController.m中
-(void)youTubeStarted:(NSNotification *)notification{ // your code here NSLog(@"youTubeStarted"); **[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO];** } -(void)youTubeFinished:(NSNotification *)notification{ // your code here NSLog(@"youTubeFinished"); } - (void)youTubeVideoExit:(id)sender { **[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO];** }
解决方法
这意味着您使用了错误的枚举类型:您使用了UIDeviceOrientation而不是UIInterfaceOrientation. 要解决此问题,只需使用UIInterfaceOrientationPortrait替换UIDeviceOrientationPortrait即可.