尽管此错误令人担忧,但不会使应用程序崩溃。我无法确定为什么会发生这种情况,尽管我发现它只在我打电话时才会发生present(picker, animated: true)
where picker
is a UIImagePickerController()
。我已将所有必要的权限添加到我的 info.plist 中,甚至创建了一个小型测试应用程序来重现此错误。
使用任何模拟器时都不会发生这种情况,而且我只能找到另一篇关于此类错误的帖子,尽管那个帖子 https://stackoverflow.com/questions/63892110/ax-lookup-problem-errorcode1100-errorpermission-denied-portnamecom-apple-i也没有得到答复。
我制作的测试应用程序由一个简单的故事板组成,其中有一个按钮可以调用UIImagePickerController()
呈现函数,然后呈现一个 imageView 来接受该照片。
这是代码ViewController.swift
:
import UIKit
class ViewController: UIViewController {
@IBOutlet var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func setPicture(_ sender: Any) {
let picker = UIImagePickerController()
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
picker.delegate = self
picker.sourceType = .photoLibrary
picker.allowsEditing = true
present(picker, animated: true)
}
}
extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imageView.image = image
}
picker.dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
}
我将在下面的控制台中包含我看到的完整错误:
2021-01-21 09:40:00.160241-0500 Outdoorist[2480:608042] [AXRuntimeCommon] Unknown client: Outdoorist
2021-01-21 09:40:07.259911-0500 Outdoorist[2480:608307] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:2483 (
0 AXRuntime 0x00000001a3f9eeac 0C4A28F7-3959-3709-8C05-A1A91EED978B + 347820
1 AXRuntime 0x00000001a3f4dfb8 _AXGetPortFromCache + 548
2 AXRuntime 0x00000001a3f4f610 AXUIElementPerformFencedActionWithValue + 460
3 UIKit 0x00000001ce67823c 737C2677-858F-3820-AD45-0EBAABC788BB + 852540
4 libdispatch.dylib 0x0000000102e8bce4 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x0000000102e8d528 _dispatch_client_callout + 16
6 libdispatch.dylib 0x0000000102e945ac _dispatch_lane_serial_drain + 748
7 libdispatch.dylib 0x0000000102e95234 _dispatch_lane_invoke + 452
8 libdispatch.dylib 0x0000000102ea0a5c _dispatch_workloop_worker_thread + 1456
9 libsystem_pthread.dylib 0x00000001ce3935a4 _pthread_wqthread + 272
10 libsystem_pthread.dylib 0x00000001ce396874 start_wqthread + 8
)
2021-01-21 09:40:07.260672-0500 Outdoorist[2480:608307] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:2483 (
0 AXRuntime 0x00000001a3f9eeac 0C4A28F7-3959-3709-8C05-A1A91EED978B + 347820
1 AXRuntime 0x00000001a3f4dfb8 _AXGetPortFromCache + 548
2 AXRuntime 0x00000001a3f4f610 AXUIElementPerformFencedActionWithValue + 460
3 UIKit 0x00000001ce67823c 737C2677-858F-3820-AD45-0EBAABC788BB + 852540
4 libdispatch.dylib 0x0000000102e8bce4 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x0000000102e8d528 _dispatch_client_callout + 16
6 libdispatch.dylib 0x0000000102e945ac _dispatch_lane_serial_drain + 748
7 libdispatch.dylib 0x0000000102e95234 _dispatch_lane_invoke + 452
8 libdispatch.dylib 0x0000000102ea0a5c _dispatch_workloop_worker_thread + 1456
9 libsystem_pthread.dylib 0x00000001ce3935a4 _pthread_wqthread + 272
10 libsystem_pthread.dylib 0x00000001ce396874 start_wqthread + 8
)
2021-01-21 09:40:07.261213-0500 Outdoorist[2480:608307] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:2483 (
0 AXRuntime 0x00000001a3f9eeac 0C4A28F7-3959-3709-8C05-A1A91EED978B + 347820
1 AXRuntime 0x00000001a3f4dfb8 _AXGetPortFromCache + 548
2 AXRuntime 0x00000001a3f4f610 AXUIElementPerformFencedActionWithValue + 460
3 UIKit 0x00000001ce67823c 737C2677-858F-3820-AD45-0EBAABC788BB + 852540
4 libdispatch.dylib 0x0000000102e8bce4 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x0000000102e8d528 _dispatch_client_callout + 16
6 libdispatch.dylib 0x0000000102e945ac _dispatch_lane_serial_drain + 748
7 libdispatch.dylib 0x0000000102e95234 _dispatch_lane_invoke + 452
8 libdispatch.dylib 0x0000000102ea0a5c _dispatch_workloop_worker_thread + 1456
9 libsystem_pthread.dylib 0x00000001ce3935a4 _pthread_wqthread + 272
10 libsystem_pthread.dylib 0x00000001ce396874 start_wqthread + 8
)
对于解决此问题或如何避免此问题的任何帮助,我将不胜感激。
我正在使用 Xcode 版本 12.3(如果有任何相关的话)。