ios - CIFilter 导致 iPhone 11 和 XR 崩溃

标签 ios swift crash core-image cifilter

CIFilter 的所有初始化都会导致某些设备 iPhone 11 和 iPhone XR 崩溃。 iOS 版本 13.3.1、13.4.1。

我试图导入:

import CoreImage
import CoreImage.CIFilter
import CoreImage.CIFilterBuiltins

但它不工作!
我使用 xCode 11.4.1 和 xCode 11.5

我尝试了几件事:
        if let filter = CIFilter(name: "CIQRCodeGenerator") {

        filter.setValue(data, forKey: "inputMessage")
        let transform = CGAffineTransform(scaleX: 5, y: 5)

        if let output = filter.outputImage?.transformed(by: transform) {
            return UIImage(ciImage: output)
        }
    }

或这个 :
let filter = CIFilter.qrCodeGenerator()

我也尝试链接到 CoreImage.framework明确地在目标设置中。

崩溃日志:
Crashed: com.apple.main-thread
0  CocoaDebug                     0x1023a0adc perform_rebinding_with_section + 332
1  CocoaDebug                     0x1023a087c rebind_symbols_for_image + 416
2  libdyld.dylib                  0x1999c3f4c invocation function for block in dyld3::AllImages::runImageCallbacks(dyld3::Array<dyld3::LoadedImage> const&) + 244
3  libdyld.dylib                  0x1999c3768 dyld3::AllImages::runImageCallbacks(dyld3::Array<dyld3::LoadedImage> const&) + 160
4  libdyld.dylib                  0x1999c8dd8 dyld3::AllImages::loadImage(Diagnostics&, unsigned int, dyld3::closure::DlopenClosure const*, bool, bool, bool, bool) + 580
5  libdyld.dylib                  0x1999c89ec dyld3::AllImages::dlopen(Diagnostics&, char const*, bool, bool, bool, bool, bool, void const*) + 868
6  libdyld.dylib                  0x1999ca434 dyld3::dlopen_internal(char const*, int, void*) + 364
7  libdyld.dylib                  0x1999bd6c0 dlopen + 116
8  CoreFoundation                 0x199bcf5c8 _CFBundleDlfcnLoadBundle + 156
9  CoreFoundation                 0x199af1eac _CFBundleLoadExecutableAndReturnError + 372
10 Foundation                     0x199ec27a8 -[NSBundle loadAndReturnError:] + 316
11 CoreImage                      0x19b479bcc invocation function for block in register_more_builtins(void (NSString*) block_pointer) + 804
12 libdispatch.dylib              0x19986833c _dispatch_client_callout + 20
13 libdispatch.dylib              0x199869a68 _dispatch_once_callout + 32
14 CoreImage                      0x19b476318 register_more_builtins(void (NSString*) block_pointer) + 304
15 CoreImage                      0x19b476b40 classNameIsSystemFilter(NSString*) + 112
16 CoreImage                      0x19b476dbc +[CIFilter(CIFilterRegistryPrivate) filterWithName:setDefaults:] + 396
17 MYApp                          0x100656598 QRCodeViewController.generateQRCode(from:) + 4370490776 (<compiler-generated>:4370490776)
18 MYApp                          0x1006563a4 QRCodeViewController.viewDidLoad() + 28 (QRCodeViewController.swift:28)
19 MYApp                          0x10065642c @objc QRCodeViewController.viewDidLoad() + 4370490412 (<compiler-generated>:4370490412)
20 UIKitCore                      0x19d6a236c -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 104
21 UIKitCore                      0x19d6a6f20 -[UIViewController loadViewIfRequired] + 952
22 UIKitCore                      0x19d6a730c -[UIViewController view] + 32
23 UIKitCore                      0x19d602fa4 -[UINavigationController _startCustomTransition:] + 1148
24 UIKitCore                      0x19d617478 -[UINavigationController _startDeferredTransitionIfNeeded:] + 692
25 UIKitCore                      0x19d618818 -[UINavigationController __viewWillLayoutSubviews] + 176
26 UIKitCore                      0x19d5fb4fc -[UILayoutContainerView layoutSubviews] + 228
27 UIKitCore                      0x19e1de6a0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2168
28 QuartzCore                     0x1a08314a0 -[CALayer layoutSublayers] + 292
29 QuartzCore                     0x1a08318e0 CA::Layer::layout_if_needed(CA::Transaction*) + 472
30 QuartzCore                     0x1a0843dc4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144
31 QuartzCore                     0x1a0788884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
32 QuartzCore                     0x1a07b33d0 CA::Transaction::commit() + 656
33 QuartzCore                     0x1a07b3fc8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 96
34 CoreFoundation                 0x199b42c54 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
35 CoreFoundation                 0x199b3d8e4 __CFRunLoopDoObservers + 420
36 CoreFoundation                 0x199b3dd84 __CFRunLoopRun + 1020
37 CoreFoundation                 0x199b3d660 CFRunLoopRunSpecific + 480
38 GraphicsServices               0x1a3f4e604 GSEventRunModal + 164
39 UIKitCore                      0x19dd1215c UIApplicationMain + 1944
40 MYApp                          0x100518e54 main + 4369190484 (<compiler-generated>:4369190484)
41 libdyld.dylib                  0x1999b91ec start + 4

使用模拟器它运行良好。

有人会知道吗?
谢谢

最佳答案

我想出了如何解决它。
问题出在第三方 CocoaDebug !
我移除了 pods ,我再也没有崩溃了!
谢谢!

关于ios - CIFilter 导致 iPhone 11 和 XR 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62260643/

相关文章:

iphone - iOS - 使用 MKMapView 弹出和推送 View Controller 时意外崩溃

ios - 我们可以从 swift 框架生成 Objective-C 静态库吗?

ios - KVO 全局范围

ios - 如何快速录制带有特定阈值滤波器的音频

swift - 作为的意思!在 Swift 1.2 - Xcode 6.3 beta 中

csv - 使用d3.csv导入时的csv文件大小限制

ios - 如何让键盘显示但不覆盖屏幕 Swift 4 底部的元素?

ios - React Native 无权限对话

swift watch 套件 : startUpdatingLocation() is unavailable

iphone - NSURLConnection使应用程序崩溃,但仅在打开和关闭电子邮件应用程序之后