Is it possible to detect non-MFI accessories on the iPhone?

我只是一个虾纸丫 提交于 2019-12-08 05:26:40

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5774906/is-it-possible-to-detect-non-mfi-accessories-on-the-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!