Connection an iPhone device to an external device
I have to develope a software that connect to an external device. The problem is the connection. Is there a way to connect without Apple's special chip?
Any way is possible:开发者_C百科 Bluetooth, Wifi, or USB.
This is far too open a question. Yes is the only answer; yes, you can connect to another device (provided it has the ability to process the connection request) via WiFi or Bluetooth.
If you're wanting to connect via WiFi, you're going to need to manage that yourself (perhaps via HTTP requests or similar to the hardware in question).
If you want to connect to a device via bluetooth, to avoid needing to use the 30-pin dock connector, take a look at the External Accessory Framework (EAAccessory Class Reference) in the xcode documentation.
Apple has no objections to connecting through WiFi, as long as you use the methods they present in their SDK.
Thank you all for the answers. I came up with a solution, please let me know if this will work and if apple will accept it:
The solution is simly to use a device with an ip (ie:101.98.13.27). The device will be connected trughe the wifi. I will send a URL request to that address and will recive the information from the device.
If you are going to try and use an ip address like you suggest you cannot hard code it. Even if it is in a private non-routable address block that address might still be used on the wifi subnet the phone is connected to. If not there is no guarantee that the connection will work depending on the permissiveness of the network devices involved.
Do you have anyway to configure the external device? If so my preferred solution would be to put both the external device and the iPhone on the same wifi network and then use mDNS (bonjour or rendezvous same thing) to have the two devices discover each other on the network.
I had a similar situation that would have been easily solved if the iPhone just supported the Bluetooth serial profile, but it doesn't. This is basically what I had planned to do but the external device was not able to support this approach.
精彩评论