开发者

How to determine whether iOS device is connected to desktop computer (and iTunes)

Is there way to determine whether an iOS device is connected to a desktop computer usi开发者_如何学编程ng USB cable and it is listed on iTunes.


Yes you can be notified of such events using The External Accessory framework.

"It is capable of sending notifications whenever a hardware accessory is connected or disconnected. Although it is capable, it does not do so automatically. Your application must specifically request that notifications be generated by calling the registerForLocalNotifications method of the EAAccessoryManager class. When an accessory is connected, authenticated, and ready to interact with your application, the framework sends an EAAccessoryDidConnectNotification notification. When an accessory is disconnected, it sends an EAAccessoryDidDisconnectNotification notification. You can register to receive these notifications using the default NSNotificationCenter, and both notifications include information about which accessory was affected."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜