当我使用 UIImagePickerController 选择图像时,出现 AX Lookup 问题 - errorCode:1100

问题描述 投票:0回答:0

首先,当我呈现图像选择器时,我收到此错误:

2023-08-03 16:47:45.979280-0700 MyAppName[7794:1889375] [AXRuntimeCommon] Unknown client: MyAppName

然后,当我选择图像时,出现此错误:

2023-08-03 16:47:51.357123-0700 DownStream[7794:1889385] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:7795 (
    0   AXRuntime                           0x00000001c1bb8acc _AXGetPortFromCache + 968
    1   AXRuntime                           0x00000001c1bbb038 AXUIElementPerformFencedActionWithValue + 852
    2   UIKit                               0x0000000220f7ae5c D402ECD6-842A-3487-9D23-92A0EA9DFBEA + 790108
    3   libdispatch.dylib                   0x00000001069f4520 _dispatch_call_block_and_release + 32
    4   libdispatch.dylib                   0x00000001069f6038 _dispatch_client_callout + 20
    5   libdispatch.dylib                   0x00000001069fe0b0 _dispatch_lane_serial_drain + 984
    6   libdispatch.dylib                   0x00000001069fedf4 _dispatch_lane_invoke + 412
    7   libdispatch.dylib                   0x0000000106a0bc74 _dispatch_workloop_worker_thread + 736
    8   libsystem_pthread.dylib             0x00000001f68f5ddc _pthread_wqthread + 288
    9   libsystem_pthread.dylib             0x00000001f68f5b7c start_wqthread + 8
)

这是我的选择器代码:

    internal func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
                var selectedImageFromPicker: UIImage?

                if let editedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage{
                    selectedImageFromPicker = editedImage
                } else if let originalImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
                    selectedImageFromPicker = originalImage
                }

                if let imageUrl = info[UIImagePickerController.InfoKey.imageURL] as? URL{
                    let imgName = imageUrl.lastPathComponent
                    let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first
                    let localPath = documentDirectory?.appending(imgName)

                    let data = selectedImageFromPicker!.pngData()! as NSData
                    data.write(toFile: localPath!, atomically: true)
                    _ = URL.init(fileURLWithPath: localPath!)

                    try! selectedImageFromPicker?.jpegData(compressionQuality: 0.1)?.write(to: imageUrl)

                    uploadFile(image: selectedImageFromPicker!)
                    picker.dismiss(animated: true, completion: nil)
                }
    }

我能做什么?有没有什么说法?

swift xcode swiftui uiimagepickercontroller swift5
© www.soinside.com 2019 - 2024. All rights reserved.