XCode SDK接入时提示: UIApplicationInvalidInterfaceOrientation

工做中由于要接IOS版本第三方的SDK,连学带作看了一天的Object-C,接入过程当中遇到了一些问题,这里记录一下。ios

问题一:

登陆测试过程当中,NSLog已成功打印登陆接口调用成功了,可是log一直输出以下信息:app

UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UINavigationController shouldAutorotate] is returning YES'。测试

解决办法:spa

问题二:

接入的sdk在登陆界面时,会形成游戏自己横屏显示,只要一出现登陆界面,游戏屏幕就会自动旋转成横屏。code

解决办法:接口

1,sdk初始化时,设置配置文件中相关属性修改。游戏

 

2,强制应用竖屏显示(本身的游戏状况),可经过以下方法。it

01,在RootViewController中io

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
   //由于游戏只支持竖屏,因此只返回竖屏状况
   #ifdef __IPHONE_6_0
       return UIInterfaceOrientationMaskPortrait;
   #endif
}

- (BOOL) shouldAutorotate {
    return YES;
}

问题三:

sdk接入后编译运行提示以下错误信息:编译

IOS App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.
解决办法:

编辑 info.plist,加入以下设置:

<plist>
<dict>
        ....
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
</dict>
</plist> 

[由于Object-C刚学,这些内容可能看起来比较简单,只是方便本身查阅,能力有限]

相关文章
相关标签/搜索