是否可以检测 iPhone 上的非 MFI 配件?
我意识到 iPhone 上不可能实际使用任何未经 MFI 认证的外部配件。有什么方法可以简单地检测连接吗?我想做的就是从 USB 驱动器获取序列号。
到目前为止,我已经尝试了以下
- (void)pollAccessories {
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nPolling Accessories..."];
NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];
for (EAAccessory *obj in accessories){
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nLocated Accessory"];
if(obj.connected)
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nConnected\r\n"];
}
}
似乎在模拟器中工作(我得到了两个“连接”的配件)。在连接到 PC 和 PS3 的手机上运行它,但没有任何乐趣。不幸的是,我手头没有合适的适配器来测试合适的 USB 驱动器。
2011 年 4 月 27 日更新:
我设法在 iHome 收音机上测试了我的代码。它确实检测到连接,因此代码正在运行。我订购了 USB 加密狗来查看是否可以检测到拇指驱动器。
I realize it is impossible to actually utilize any external accessories that are not MFI certified with the iPhone. Is there any way to simply detect a connection? All I would like to do is acquire the serial number from a USB drive.
So far I've tried the following
- (void)pollAccessories {
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nPolling Accessories..."];
NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];
for (EAAccessory *obj in accessories){
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nLocated Accessory"];
if(obj.connected)
statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nConnected\r\n"];
}
}
Seems to work in the simulator (I'm getting two accessories that are "connected"). Ran it on my phone connecting to a PC and my PS3 with no joy. Unfortunately I don't have the appropriate dongle on hand to test a proper usb drive.
UPDATE 4/27/11:
I managed to test my code on an iHome radio. It does detect the connection, so the code is working. I've ordered a USB dongle to see if I can detect a thumb drive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我拿到了 USB 加密狗,遗憾的是操作系统没有提供连接到非 MFI 设备的指示。如果没有某种经过 MFI 认证的中间加密狗,这是不可能的。
I got my hands on a USB dongle and sadly the OS provides no indication of a connection to a non-MFI device. This is not possible without some sort of intermediary dongle that is MFI certified.