遇到错误

一、在block函数中规避警告信息 "capturing self strongly in this block is likely to lead to a retain cycle”

__weak typeof(self) weakSelf = self;//加此行代码
_BView.giftBlock = ^{
[weakSelf loadGiftData];
//弹出礼物界面
[weakSelf showGiftView];
};
__weak typeof(self) weakSelf = self;//同上
_giftView.addMoneyBlock =^{
[weakSelf performSegueWithIdentifier:@"giftToAddMoneySegue" sender:nil];
};

二、"this class is not key value coding-compliant for the key …"问题的解决


此问题 一般都是由interface build与代码中IBOutlet的连接所引起的。

可能是在代码中对iboutlet的名称进行了修改,导致interface build中的连接实效。

如果在该viewcontroller连接的xib文件中没发现错误,

那就很可能是mainWindow.xib文件中存在问题.

或者:

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{

}

可解决

reason: 'NSLayoutConstraint for <UIWebView: 0x7fc8b350f2c0; frame = (0 0; 0 0); layer = <CALayer: 0x6000004335c0>>: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs.

解决:不先将视图加入到父视图中使用masonry时会崩溃 (即 [self.view addSubview:webView];的位置问题)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容