An application to check iPhone connection with USB

冷暖自知 提交于 2019-12-01 20:26:17

问题


I want to know if an iPhone is connected to USB programmatically.

So far by googling i found http://developer.apple.com/programs/mfi/.

Do I really need this api to find out whether an iPhone is connected to USB device?

I just want to make an iPhone app that prints out in console whether the iPhone is connected with USB or not.

Thanks much.


回答1:


You might be able to use the solution from this question.

The solution detects if the device's battery is currently being charged which, if connected to USB, most likely will be unless it is a 3rd party accessory in which case there's a different SDK for those I believe.

In any case, if the solution isn't helpful it might point you in the right direction.

UPDATE: Did some more digging and it appears that this may not be possible other than the battery charging solution mentioned previously.

So to answer your question "Do I really need this api to find out whether an iPhone is connected to USB device?":

Yes, it appears that way.



来源:https://stackoverflow.com/questions/7426258/an-application-to-check-iphone-connection-with-usb

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