Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

崩溃 #352

Open
leeqiangzi opened this issue Aug 22, 2023 · 5 comments
Open

崩溃 #352

leeqiangzi opened this issue Aug 22, 2023 · 5 comments

Comments

@leeqiangzi
Copy link

[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;
}

@Pledge-WX
Copy link

在iOS17中UIGraphicsBeginImageContextWithOptions已经被废弃了,这个作者应该已经不更新了吧!我准备换掉

@RITL
Copy link

RITL commented Sep 27, 2023

可以手动改一下:

    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

@LBG-lbg
Copy link

LBG-lbg commented Nov 15, 2023

判断一下 CGSizeEqualToSize(view.bounds.size, CGSizeZero)

@LBG-lbg
Copy link

LBG-lbg commented Nov 15, 2023

最好拉个分支 自己改 自己pod自己的分支,这次iOS17 要改的第三方很多

@QiuYeHong90
Copy link

https://github.com/QiuYeHong90/YBImageBrowser 可以关注我修复的仓库 我解决了一些bug 和 ui 的问题, 欢迎提issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants