gpt4 book ai didi

ios - '-[CIContext initWithOptions :]: unrecognized selector sent to instance

转载 作者:搜寻专家 更新时间:2023-10-31 08:15:13 26 4
gpt4 key购买 nike

我用它来生成一个大图像:

let context = CIContext(options: nil)
let bitmapImage: CGImageRef = context.createCGImage(image, fromRect: extent)!
CGContextSetInterpolationQuality(bitmapRef, CGInterpolationQuality.None)
CGContextScaleCTM(bitmapRef, scale, scale);
CGContextDrawImage(bitmapRef, extent, bitmapImage);
let scaledImage: CGImageRef = CGBitmapContextCreateImage(bitmapRef)!
return UIImage(CGImage: scaledImage)

它在 iOS 9 和 10 中运行良好,但在 iOS 8 中运行良好。我在调试器中得到了这个:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CIContext initWithOptions:]: unrecognized selector sent to instance 0x7f868d5dc8e0'

此外。我尝试使用 let context = CIContext() 代替。但是我在第二行没有得到。我正在使用 Xcode 8 和 Swift 2.3。请在这件事上给予我帮助!谢谢!

最佳答案

我不知道这是否可行,但我们应该尝试一下:让我们用 Objective-C 编写该行。所以:

上下文生成器.h

#import <Foundation/Foundation.h>
#import <CoreImage/CoreImage.h>

@interface ContextMaker : NSObject

+ (CIContext*) makeMeAContext;

@end

语境制作者.m

#import "ContextMaker.h"

@implementation ContextMaker

+ (CIContext*) makeMeAContext {
return [CIContext contextWithOptions:nil];
}

@end

桥接头:

#import "ContextMaker.h"

swift :

let c = ContextMaker.makeMeAContext()

尝试一下只需要一点时间,所以试一试,看看我们是否可以越过那条麻烦的线...

关于ios - '-[CIContext initWithOptions :]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39939415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com