1.在項目中碰到一個問題:在UIWebView中,調用原生相機或圖庫,程序會重啟到啟動畫面。查看打印信息,如下:
Warning: Attempt to present <UIImagePickerController: 0x12734be00> on <MBTabBarVC: 0x1270fc000> whose view is not in the window hierarchy!
網上查了很多資料才知道,選擇一個選項時,會把當前的ViewController dismiss掉,但是這里貌似是一個bug,dismiss了兩次,結果第二次把tabbar(我的項目是tabbar-nav-viewController)給銷毀了(斷點到dealloc可以看到),然后就理所當然的崩潰了。
解決辦法:
在自定義的tabbar中,重寫dismiss方法,之所以第二次會dismiss tabbar,是因為第二次dismiss時,self.presentedViewController是一個nil。所以解決代碼如下:
-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
{
if ( self.presentedViewController)
{
[super dismissViewControllerAnimated:flag completion:completion];
}
}
參考:ios 10 在WebView中選擇文件上傳 出現 whose view is not in the window hierarchy!
2.Xcode 7以后沒有dylib文件
解決辦法:
- Go to Build Phases >Link Binary with Librairies > + > Add other
- Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
- From /usr/lib you can add : libz.dylib and more...
- Compile and have fun
3.Profile doesn't match the entitlements file's value for the application-identifier entitlement
解決辦法:
target-capbilities-打開iCloud,然后關閉icloud,即可
Profile doesn't match the entitlements file's value for the application-identifier entitlement