工做中由於要接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剛學,這些內容可能看起來比較簡單,只是方便本身查閱,能力有限]