ForgetSou | Blog

❤ 武统台湾 刻不容缓 ❤

0%

日常报错收集记录

1.LGAlertView库viewWillTransitionToSize崩溃

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

__weak typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:coordinator.transitionDuration animations:^{
[self setNeedsStatusBarAppearanceUpdate];
[self.alertView layoutValidateWithSize:size];
}];
});
}

-[_UIViewControllerOneToOneTransitionContext _duration]: message sent to deallocated instance

po coordinator.transitionDuration输出 error: property 'transitionDuration' not found on object of type 'id'

解决方法:

使用硬编码的持续时间,pod 'LGAlertView'更改为vovnit的派生库

pod 'LGAlertView', :git => 'https://github.com/vovnit/LGAlertView.git'

vovnit的派生库的具体解决方案

@vovnit的具体解决方式如下:

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
if (coordinator) {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

@try {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
__weak typeof(self) weakSelf = self;
[UIView animateWithDuration:0.5 animations:^{
if (weakSelf) {
if ([weakSelf respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
[weakSelf setNeedsStatusBarAppearanceUpdate];
}
if (weakSelf.alertView) {
[weakSelf.alertView layoutValidateWithSize:size];
}
}
}];
}];
} @catch (NSException *exception) {
//
} @finally {
//
}
}

2. Name types using UpperCamelCase.

骆驼拼写法

在单次底部有波浪线提示Typo: In word ''时,是由于未按照骆驼拼写法进行定义,一般是单词拼写错误了。如:

class RandowWords extends StatelessWidget {
@override
Widget build(BuildContext context) {
final wordPair = new WordPair.random();

return Padding(
padding: const EdgeInsets.all(8.0),
child: new Text('随机字符串:${wordPair.toString()}'),
);
}
}

RandowWords底部会提示Typo:In word 'Randow';此时是由于“随机”单词拼写错误,修改为Random就可以了。

3. hexo 报错

hexo s
ERROR Cannot find module 'hexo' from '/Users/pv/myBlog/blog'
ERROR Local hexo loading failed in ~/myBlog/blog
ERROR Try running: 'rm -rf node_modules && npm install --force'

只需要运行以下命令安装下就可以了

npm install hexo-util --save

个人博客: 🏡 ForgetSou


-------------本文结束感谢您的阅读-------------
坚持原创技术分享,您的支持将鼓励我继续创作!

欢迎关注我的其它发布渠道