问题集
问题:Unable to run app in Simulator 描述: An error was encountered while running (Domain = NSPOSIXErrorDomain, Code = 3) 在模拟器打开的情况下升级Xcode,安装完成之后直接运行,报错 解决: 重启模拟器
问题:*** -[DetailPageViewController scrollViewDidScroll:]: message sent to deallocated instance 0x19a13c90 描述: viewController释放之后,scrollViewDidScroll:方法又被调用, 解决: 将调用该方法的delegate置为nil。 问题:*** -[NSIndexPath section]: message sent to deallocated instance 0x17dbc970 描述: The app crashes when someone highlights a cell while scrolling fast, and then the OS tries to unhighlight it when it moves off screen, when it ceases to exist. 解决: - (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath { return NO; } return NO; 之后下面的方法无法执行,cell上添加UITapGestureRecognizer手势代替cell点击事件 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {}
问题: Could not load the “image.png” image 描述: Could not load the “image.png” image referenced from a nib in the bundle with identifier “com.bundle.identifier” 解决: 将报错的图片全部从工程中删除,再添加进去
问题:CG_CONTEXT_SHOW_BACKTRACE 描述: Oct 19 10:27:05 [2995] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Oct 19 10:27:05 [2995] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Oct 19 10:27:05 [2995] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. 解决: iOS9之后,info.plist中View controller-based status bar appearance设置为NO的话,就会报以上警告 使用iOS7以后的方法: 在viewController中调用 - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } 在navigationController中调用 - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } - (UIViewController *)childViewControllerForStatusBarStyle { return self.topViewController; }
问题:iOS9访问网络失败 描述: iOS9引入了新特性App Transport Security (ATS),新特性要求App内访问的网络必须使用HTTPS协议 解决: 在Info.plist中添加NSAppTransportSecurity类型Dictionary。 在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
问题:pod 安装第三方库编译报错 描述: Unable to run command 'StripNIB XMTopCell.nib' - this target might include its own product. Unable to run command 'StripNIB XMTopCell~iphone.nib' - this target might include its own product. Unable to run command 'StripNIB XMTopCell~ipad.nib' - this target might include its own product. 解决: podspec文件中添加s.resource = '*/*.xib';
问题:*** -[UIKeyboardLayoutStar release]: message sent to deallocated instance 0x7f9e7c2ccd40 解决:用自定义方法替换可变数组的原有objectAtIndex方法解决数组越界问题时,造成键盘崩溃,使用其他方法解决数组越界问题