问题
I had asked this question earlier but was closed for unclear or insufficient details. Hopefully, I have explained it better. Here it goes.
I am building an iOS application that communicates to the external accessory using a proprietary protocol (over iAP). I know that by adding a unique protocol name in the info.plist file, the application can be made to launch automatically when iOS device is connected to the external accessory (I am aware that support is needed from the external accessory device too).
Applications that are able to communicate with an external accessory should declare the ?protocols they support in their Info.plist file. Declaring support for specific protocols lets the system know that your application can be launched when that accessory is connected. If no application supports the connected accessory, the system may choose to launch the App Store and point out applications that do.
In my application, I wish to give the user a graphical interface to enable or disable automatically launching the application. Behind the scenes, this would require setting the protocol name to a pre-defined value to enable it or clearing it to disable it.
I would appreciate if someone can give me information on how to modify the protocol id programatically.
回答1:
To load app automatically when Supported external accessory is connected, we need to put two things in the Info.plist:
Supported external accessory protocols
Item 0 yourCompanyProtocol
Application does not run in background
YES
来源:https://stackoverflow.com/questions/11216713/re-post-ios-modify-app-auto-launch-when-iphone-is-connected-to-external-accesso