Xcode AX 查找问题 - 仅发生在真实设备上
Posted
技术标签:
【中文标题】Xcode AX 查找问题 - 仅发生在真实设备上【英文标题】:Xcode AX Lookup problem - Only occurs on real device 【发布时间】:2021-01-21 14:55:14 【问题描述】:虽然令人担忧,但此错误不会导致应用程序崩溃。我一直无法确定它发生的原因,尽管我发现它仅在我调用present(picker, animated: true)
时发生,其中picker
是UIImagePickerController()
。我已将所有必要的权限添加到我的 info.plist,甚至创建了一个小型测试应用来重现此错误。
使用任何模拟器时都不会发生这种情况,我只能找到另一个关于此类错误的 SO 帖子,尽管 that post 也没有得到答复。
我制作的测试应用程序包含一个简单的故事板,其中包含一个用于调用 UIImagePickerController()
present 函数的按钮,然后是一个用于接受该照片的 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。
【问题讨论】:
【参考方案1】:我认为这与 ios 14 的受限图像选择器权限对话框有关,该对话框在单独的线程中打开。因此,当回调返回时,您应该在主线程上执行 UI 任务。请尝试以下操作:
let picker = UIImagePickerController()
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary)
picker.delegate = self
picker.sourceType = .photoLibrary
picker.allowsEditing = true
DispatchQueue.main.async
self.present(picker, animated: true)
【讨论】:
我刚刚尝试了这段代码,不幸的是,它并没有消除错误。我仍然看到完全相同的错误输出。 好的,您的设备在 iOS 13 上吗?看起来在 iOS 13 上出现了一个相关的错误 (FB7513956) msolarana.netlify.app/2020/01/20/bugs-galore 针对同样的问题 不,不是。我尝试在两个运行 iOS 14.3 的不同 iPhone X 上运行,不幸的是我没有任何其他设备可以尝试。 iPadAir iOS14.4 当 imagepicker 出现时它抛出 [AXRuntimeCommon] Unknown client:myappname 当它完成它抛出 [AXRuntimeCommon] AX 查找问题 - errorCode:1100 错误:Permission denied portName:'com.apple .iphone.axserver 的 PID:####。它不会破坏我的应用程序。第二个错误被报告为 13.3 中的错误,据说已修复。我猜不会。 Mailcomposer 也在发挥作用,感觉它与现在以页面形式呈现的模态视图有关。以上是关于Xcode AX 查找问题 - 仅发生在真实设备上的主要内容,如果未能解决你的问题,请参考以下文章
应用程序图标在使用 xcode 10 的真实设备上显示为空白
React Native - 在真实设备上构建时出现 XCode 错误?
仪器无法在 Xcode 4.4 的真实 iOS 设备中运行 GUI 测试脚本