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