当前位置:   article > 正文

Xcode 15和iOS 17 适配和问题_xcode15 ios17 适配

xcode15 ios17 适配

1.Showing Recent Messages PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/mac/Library/Devel

把项目下Pods-App-Fremeworks.sh文件

if [ -L "${source}" ]; then

    echo "Symlinked..."

    source="$(readlink "${source}")"

fi

改为

if [ -L "${source}" ]; then

    echo "Symlinked..."

    source="$(readlink -f "${source}")"

fi

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

可改成:

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];

    }];

3.SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a'; try increasing the minimum deployment target

进入/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/文件夹,如果无arc文件夹就创建一个把 libarclite_iphonesimulator.a放回到arc文件夹 没这个文件的可以github搜索拿下来

4.Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410 崩溃

那是YYText的 YYTextAsyncLayer文件在Xcode15 UIGraphicsBeginImageContextWithOptions下面加了断言而产生的,iOS17系统造成了影响,处理如下

if (@available(iOS 17.0, *)) {

            if (self.bounds.size.width < 1 || self.bounds.size.height < 1) {

                CGImageRef image = (__bridge_retained CGImageRef)(self.contents);

                self.contents = nil;

                if (image) {

                    CFRelease(image);

                }

                return;

            }

            UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:self.bounds.size];

            UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {

                if (self.opaque) {

                    if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {

                        CGContextSetFillColorWithColor(context.CGContext, [UIColor whiteColor].CGColor);

                        [context fillRect:self.bounds];

                    }

                    if (self.backgroundColor) {

                        CGContextSetFillColorWithColor(context.CGContext, self.backgroundColor);

                        [context fillRect:self.bounds];

                    }

                }

                task.display(context.CGContext, self.bounds.size, ^{return NO;});

            }];

            

            self.contents = (__bridge id)(image.CGImage);

            

        }else{

            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);

        }

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
  

闽ICP备14008679号