Open leeqiangzi opened 1 year ago
在iOS17中UIGraphicsBeginImageContextWithOptions已经被废弃了,这个作者应该已经不更新了吧!我准备换掉
可以手动改一下:
UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
format.opaque = YES;
format.scale = [UIScreen mainScreen].scale;
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:view.bounds.size format:format];
UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
}];
@leeqiangzi
判断一下 CGSizeEqualToSize(view.bounds.size, CGSizeZero)
最好拉个分支 自己改 自己pod自己的分支,这次iOS17 要改的第三方很多
https://github.com/QiuYeHong90/YBImageBrowser 可以关注我修复的仓库 我解决了一些bug 和 ui 的问题, 欢迎提issue
[Unknown process name] CGBitmapContextCreateImage: invalid context 0x281fa4cc0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
断点崩溃在该方法中: UIImage YBIBSnapshotView(UIView view) { UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale); [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // crash it return image; }