项目中的bug汇总

一、关于UIVisualEffectView报错的问题:

Assertion failure in -[UIVisualEffectView _addSubview:positioned:relativeTo:],   
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3694.4.18/UIVisualEffectView.m:1464 

添加全局断点找到错误所在:
这里写图片描述

后来找到了是为UIVisualEffectView添加子View的方式不对,在ios 11上必须添加到它的contentView内:
[self.effectview.contentView addSubview:iconButton];

关于UIVisualEffectView主要是用于设置毛玻璃效果,我们很多时候设置蒙版View时会设置为半透明的黑色,而在ios8.0以后推出的UIVisualEffectView可以设置更炫酷的蒙版效果,ios系统里常用于导航栏和标签栏上。

UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];  
UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur];  
effectview.frame = self.navigationController.view.frame;  


二、屏幕截图崩溃

warning: could not execute support code to read Objective-C class data in the process.   
This may reduce the quality of type information available.  

网上查找原因:说是因为方法的循环调用
自己查找原因是:
[sourceView.layer renderInContext:ctx];

解决办法:

原始屏幕截图:[view.layer renderInContext:ctx];  

改为:[view drawViewHierarchyInRect:view.frame afterScreenUpdates:NO];  


三、IQKeyboardManager报错问题

*** -[UICompatibilityInputViewController retain]: message sent to deallocated instance 0x7fd86bdb8ce0

原因:在分类里面重写了dealloc方法, 特别要注意,在写分类的时候,一定不要重写方法,若重写方法必须在继承里面。

你可能感兴趣的:(调试,测试,oc,其它,学习)