What is Apple MFi and how to use it?
As you may already know, handheld devices these days are able to do a lot more than just show basic applications. Mobile devices can do a wide range of things, from accessing your bank account to managing your house and controlling external hardware and peripherals. In this blog post, we’ll focus on the latter. Since the beginning, iOS has been particularly open to allowing apps to communicate with external hardware by providing several Software Development Kits (SDKs) to do the task. But first, let’s clarify what exactly is MFi.
Allows manufacturers to create peripherals
MFi program (Made For iPhone/iPod/iPad) is a licensing program created by Apple. It’s main purpose is to allow manufacturers to create hardware and software peripherals that can work with Apple’s devices. This program involves any device that can be connected through the headphone jack, the original 40 pin dock connector, or the lightning connector. It also involves devices that can be accessed through wireless connections, such as bluetooth.
How to interact with an MFi device
The question probably every developer has about MFi is “How do I code something to interact with hardware?” As always, Apple provides excellent SDKs to perform everything related to communication. This SDK is called ExternalAccessory, and it already comes with the platform, which means no extra steps are needed to install it (just remember to add the key to the info.plist).
This time we won’t go into details about the implementation of this SDK, but believe us, it is pretty straightforward. There’s only one thing you need to know about the communication: The single thing you can send and receive through ExternalAccessory are bytes through a stream. What you do with the bytes you receive is up to you! The SDK is only responsible for sending and receiving the data.
Our curated list of available documentations
Even though Apple provides, as always, an official documentation, there’s not a lot of information around the internet on how to develop an application for the MFi program. That’s why we created this curated list of documents, examples and tutorials to follow:
MFi general information:
Integrating hardware devices with iOS apps is not an easy task. There are a lot of challenges that arise when working with hardware, such as protocols and connections. If you have any questions, don’t hesitate to ask us!