gpt4 book ai didi

ios - iOS 中 CameraRoll.saveToCameraRoll 上的应用程序崩溃

转载 作者:可可西里 更新时间:2023-11-01 05:01:25 26 4
gpt4 key购买 nike

我正在尝试在我的 iOS react native 应用程序中将屏幕截图保存到相机胶卷,但一旦调用 CameraRoll.saveToCameraRoll,应用程序就会崩溃。它一直工作到 iOS 10 和 react-native 0.47。它在 Android 中运行良好。

我已经在 Info.plist 中拥有 iOS 10+ 所需的权限。

这是我将图像保存到相机胶卷的代码。

CameraRoll.saveToCameraRoll(mUri, 'photo')
.then(()=>console.log('saved to CameraRoll'))
.catch(()=>console.log('error in saving'))

请注意,我没有收到以上两个的任何控制台日志。这是 native 崩溃,下面是崩溃线程。

Thread 39 Queue : com.apple.root.default-qos (concurrent)
#0 0x000000010c8280aa in __abort_with_payload ()
#1 0x000000010c824326 in abort_with_payload_wrapper_internal ()
#2 0x000000010c82434f in abort_with_payload ()
#3 0x000000010c9d2b09 in __CRASHING_DUE_TO_PRIVACY_VIOLATION__ ()
#4 0x000000010c9d2a53 in __TCCAccessRequest_block_invoke.77 ()
#5 0x000000010c9d6273 in __tccd_send_block_invoke ()
#6 0x000000010c76ead5 in _xpc_connection_reply_callout ()
#7 0x000000010c76417c in _xpc_connection_call_reply_async ()
#8 0x000000010c39f49e in _dispatch_client_callout3 ()
#9 0x000000010c3b7658 in _dispatch_mach_msg_async_reply_invoke ()
#10 0x000000010c3a407d in _dispatch_queue_override_invoke ()
#11 0x000000010c3ab1f9 in _dispatch_root_queue_drain ()
#12 0x000000010c3aae97 in _dispatch_worker_thread3 ()
#13 0x000000010c85d5a2 in _pthread_wqthread ()
#14 0x000000010c85d07d in start_wqthread ()
Enqueued from com.apple.libdispatch-manager (Thread 42) Queue : com.apple.libdispatch-manager (serial)
#0 0x000000010c3b405c in _dispatch_mach_reply_merge_msg ()
#1 0x000000010c3ba3f3 in _dispatch_event_loop_merge ()
#2 0x000000010c3b2481 in _dispatch_kevent_worker_thread ()
#3 0x000000010c85d47b in _pthread_wqthread ()
#4 0x000000010c85d07d in start_wqthread ()

最佳答案

我也遇到了同样的问题。通过在 info.plist 中添加 NSPhotoLibraryAddUsageDescription("Privacy - Photo Library Additions Usage Description") 修复。

这是 iOS 11 的新规则。

关于ios - iOS 中 CameraRoll.saveToCameraRoll 上的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46581830/

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