YBImageBrowser 闪退

黎先生_IP属地: 河南
0.122字数 11阅读 453

报错:

warning: Module "/Users/xxx/Library/Developer/Xcode/iOS DeviceSupport/iPhone15,2 17.3.1 (21D61)/Symbols/usr/lib/libobjc.A.dylib" uses triple "arm64e-apple-ios17.3.0", which is not compatible with the target triple "arm64-apple-ios11.0.0". Enabling per-mod

解决方法:

UIImage *YBIBSnapshotView(UIView *view) {
//    UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale);
//    [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
//    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
//    UIGraphicsEndImageContext();
    
    CGSize size = view.bounds.size;
    UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
    format.scale = [UIScreen mainScreen].scale;
    UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:size format:format];
    UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
    }];
    return image;
}

YYTextAsyncLayer 闪退

//        UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale);
//        CGContextRef context = UIGraphicsGetCurrentContext();
//        if (self.opaque) {
//            CGSize size = self.bounds.size;
//            size.width *= self.contentsScale;
//            size.height *= self.contentsScale;
//            CGContextSaveGState(context); {
//                if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {
//                    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
//                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
//                    CGContextFillPath(context);
//                }
//                if (self.backgroundColor) {
//                    CGContextSetFillColorWithColor(context, self.backgroundColor);
//                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
//                    CGContextFillPath(context);
//                }
//            } CGContextRestoreGState(context);
//        }
//        task.display(context, self.bounds.size, ^{return NO;});
//        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
//        UIGraphicsEndImageContext();
//        self.contents = (__bridge id)(image.CGImage);
        UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
              format.opaque = self.opaque;
              format.scale = self.contentsScale;

              UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:self.bounds.size format:format];
              UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
                  CGContextRef context = rendererContext.CGContext;
                  if (self.opaque) {
                      CGSize size = self.bounds.size;
                      size.width *= self.contentsScale;
                      size.height *= self.contentsScale;
                      CGContextSaveGState(context); {
                          if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {
                              CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
                              CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
                              CGContextFillPath(context);
                          }
                          if (self.backgroundColor) {
                              CGContextSetFillColorWithColor(context, self.backgroundColor);
                              CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));
                              CGContextFillPath(context);
                          }
                      } CGContextRestoreGState(context);
                  }
                  task.display(context, self.bounds.size, ^{return NO;});
              }];

              self.contents = (__bridge id)(image.CGImage);
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
1人点赞
更多精彩内容,就在简书APP
"小礼物走一走,来简书关注我"
还没有人赞赏,支持一下
总资产6共写了1.3W字获得33个赞共9个粉丝

推荐阅读更多精彩内容