gpt4 book ai didi

ios - Xcode 10 主线程检查器 : Cordova Camera Plugin

转载 作者:行者123 更新时间:2023-12-01 17:46:30 25 4
gpt4 key购买 nike

在 iOS13 发布后,我正在测试使用 Cordova 的混合应用程序。启动相机非常慢,并生成以下内容:

============================================= ==================

主线程检查器:在后台线程上调用的 UI API:-[UIImagePickerController init]

PID:1347,TID:618928,线程名称:(无),队列名称:com.apple.root.default-qos,QoS:0

回溯:

4 0x0000000100f1bba0 +[CDVCameraPicker createFromPictureOptions:] + 124

5 0x0000000100f15d54 -[CDVCamera showCameraPicker:withOptions:] + 108

6 0x0000000100f15570 __25-[CDVCamera takePicture:]_block_invoke_2 + 336

7 AVFoundation 0x00000001b76178f8 2BC0C357-314E-3AE8-B006-C28528B87512 + 710904

8 TCC 0x00000001b35dfbf8 85A762AF-99DB-3B4C-B24B-09600CC17196 + 7160

9 TCC 0x00000001b35e3de4 85A762AF-99DB-3B4C-B24B-09600CC17196 + 24036

10 libxpc.dylib 0x00000001acfe3804 79A1F1AD-9CB4-3334-91D9-E1ED6B1032A3 + 104452

11 libxpc.dylib 0x00000001acfd72c4 79A1F1AD-9CB4-3334-91D9-E1ED6B1032A3 + 53956

12 libdispatch.dylib 0x000000010109b3b4 _dispatch_client_callout3 + 20

13 libdispatch.dylib 0x00000001010b7000 _dispatch_mach_msg_async_reply_invoke + 392

14 libdispatch.dylib 0x00000001010ada8c _dispatch_kevent_worker_thread + 1436

15 libsystem_pthread.dylib 0x00000001ad0e6adc _pthread_wqthread + 336

16 libsystem_pthread.dylib 0x00000001ad0ecc7c start_wqthread + 8

Xcode 10.3cordova-plugin-camera 版本 4.1.0

在 iPhone X、iOS13 上运行

最终相机打开并允许我拍照,但之后 UI 显示不正确。我尝试创建一个全新的应用程序,只添加了相机插件,但同样的事情发生了。

如何解决?

最佳答案

看来UIImagePickerController需要在UI Thread中调用。幸运的是,代码已经准备好进行更改!

只需将 cameraPicker 初始化部分移动到主线程部分:

dispatch_async(dispatch_get_main_queue(), ^{
// UI MainThread execution
CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
weakSelf.pickerController = cameraPicker;

cameraPicker.delegate = weakSelf;
cameraPicker.callbackId = command.callbackId;
// we need to capture this state for memory warnings that dealloc this object
cameraPicker.webView = weakSelf.webView;
...
}

D.

关于ios - Xcode 10 主线程检查器 : Cordova Camera Plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58038810/

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