问题描述
我意识到,实际上不可能使用未经iPhone MFI认证的任何外部配件.有什么方法可以简单地检测连接吗?我要做的就是从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"];
}
}
似乎可以在模拟器中工作(我正在获得两个已连接"的附件).毫无疑问地将其运行在连接到PC和PS3的手机上.不幸的是,我手头没有合适的加密狗来测试正确的USB驱动器.
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:
UPDATE 4/27/11:
我设法在iHome收音机上测试了我的代码.它确实检测到连接,因此代码可以正常工作.我已经订购了USB加密狗,看看是否可以检测到拇指驱动器.
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.
推荐答案
我把手放在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.
这篇关于是否可以在iPhone上检测到非MFI附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!