Question

I'm being called upon to build a web app that interfaces with an iphone accessory. I see that native apps use the ExternalAccessory.framework to access accessory, but so far I'm seeing no indication that this framework is in any way exposed for web apps. Is this possible (and if so, what is the entry point), or do we just need to build native?

Was it helpful?

Solution

What you're likely going to have to do is use a native app as a layer of communication between the iOS accessory and the web server. In other words you're going to have to intercept all of the responses from the web server and translate those for the accessory via native objective-C. If you write a native app with a viewcontroller that is a UIWebViewController and either have the web server bake in command payloads in its response messages or gruelingly parse the HTML for embedded commands you can pull it off. My company uses a 3rd party accessory in this manner and while it's not pretty it works. I mean "not pretty" in the sense that your commands are static per your app build and underlying handling of the accessory. Good luck!

Quick EDIT: Depending on how re-usable you want to make interfacing with this accessory you could always create a framework with the commands baked in. That way when you need to alter or expand the command/control schema all you have to do is change the framework (yes, that will require a build). It will also allow you to easily adopt the same control across multiple apps in a fast manner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top