iPadOS 16.1下使用IORegistryEntryCreateCFProperties无法获取Driver属性
DriverKit驱动属性读取异常问题
我们使用DriverKit开发驱动程序,客户端App可成功发现驱动,但调用IORegistryEntryCreateCFProperties读取IORegistry属性时,仅能获取到IOClass这一项属性,其他属性均无法读取。
客户端App中用于读取属性的代码如下:
private func debugRegistry(device: io_object_t) { var dictionary: Unmanaged<CFMutableDictionary>? IORegistryEntryCreateCFProperties(device, &dictionary, kCFAllocatorDefault, .zero) if let dictionary = dictionary { let values = dictionary.takeUnretainedValue() print(values) } }
输出结果为:
{ IOClass = IOUserService; }
在macOS上测试相同代码时,输出包含20多个属性。由此推测iPadOS上的IOKit限制了除IOClass外的其他属性读取权限。
环境信息
- Xcode:Version 14.1 beta 2 (14B5024i)
- iPadOS:iOS 16.1 (20B5050f)
内容的提问来源于stack exchange,提问作者Myurik
相关产品推荐
相关产品推荐

