Even those readers who are most skeptical of Apple products will like this Bluetooth Low Energy (BLE)-enabled iOS app tutorial from [Akio].
With everything being “connected” these days smartphone applications are of course a ubiquitous part of our existence. We’ve seen plenty of examples connecting your Bluetooth-enabled projects to an Android device, but comparatively fewer tutorials for connecting to iOS devices. This mostly has to do with Android’s much larger market share and also Android’s more open-source friendly business model. Nevertheless, if you do much IoT development either as a hobby or professionally, then you probably find yourself interacting with Apple devices more than you like to admit.
[Akio’s] app is essentially updating a chart, in real-time, with data read from an Adafruit nRF52832 Feather board. He then walks you through all the basics of creating a user interface (UI) using Apple’s Storyboard interface, a simple drag-and-drop scheme similar to something you’ve probably used in many other contexts. [Akio] shows readers how to add buttons for allowing users to interact with the app, labels for displaying data to the user, as well as walks you through Apple’s odd methodology of connecting UI elements to code using IBAction and IBOutlets. The highlight of his tutorial is showing readers how to add charts to their iOS apps which seems to take a few more steps than you might imagine.
[Akio] does a really good job detailing all the relevant functions so that readers will hopefully understand what each piece of the code is doing. And we really enjoyed him adding individual video tutorials for some of the trickier programming steps. He also readily admits that some folks may opt to develop their UI exclusively in code as opposed to the Storyboard but he argues that the Storyboard is still important for beginners and is really handy when the UI is fairly simple.
Of course, in true open-source fashion, [Akio] provides all his code on his GitHub repository so you can clone the repo and run the code yourself as well as credit some of the resources he used while making his app. Two things we really love to see. Hopefully, [Akio’s] tutorial will make connecting to iOS devices seem much less onerous than it once was.
I would disagree with market share having any impact on why ble was not developed for ios. It was not developed because ios is closed source and apple puts lots of limitations on what apps can be loaded. you cannot side load an app even for developement purposes, you must go through apples walled garden and app store. Apple had significantly more market share a few years ago(smart phone)
Not sure why you say you can’t side load an app. You absolutely can, and with a developer license it will persist. I just did it with high school students.
Notwithstanding I do agree with your larger point that apple’s strict control of their dev environment is prohibitively difficult for novice learners. While we could test the students’ projects on a phone with sideloading we gave up on doing much with it because of how hard every step was.
I agree. A number of years ago I was reviewing what it would take to create an iOS Bluetooth app and it took the entire day. In contrast… I looked at Android and literally within a few hours I already had a basic Android Bluetooth app created and working. I should also mention that at the time iOS officially required development on a Mac… whereas for Android, I could choose whatever development platform that suited me. It is no wonder that the number of Android Apps have increased much faster than iOS.
Similar here. My boss dropped off a new Mac still in boxes to my office as he wanted me to start developing Mac apps as well. I never unpacked as I was too busy developing Android app. Eventually it was picked up still unpacked.
Also some falsities here. You could have gone on the Apple Developer site and downloaded their sample program, and you would have your first BLE app up and running in an hour, maybe two.
And you don’t need a Mac to develop your app. You only need a Mac when you want to actually publish your app. Because your app needs to be signed, and that can only done on a genuine Mac.
Of course I acknowledge that Xcode only runs on Macos. But you can develop on a Windows laptop/PC with Macos on it (Hackintosh). Or in a virtual machine environment with Macos installed.
I expect you already had prior experience with Java and Android, which makes your comparison a bit unfair.
If you ask me, the biggest hurdle is learning all those Apple API’s, and learning Swift (don’t start with Objective C now).
I program for iOS for a living, and actually work on BLE-enabled apps.
“you cannot side load an app even for developement purposes, you must go through apples walled garden and app store.”
Of course you can. Just try to download Xcode, and you will find out your apps run fine on your iPhone.
However, the certificate does expire after a certain amount of time (like 2 weeks, not exactly sure). After that, you can simply rebuild your app and install it again. While developing, this isn’t a problem at all, unless you develop in short stretches with 2 or more weeks pause in between.
If you want to publish your app for internal use, you will have to go through two hoops. You have to have a dev account (costs 100 dollars a year, way, way cheaper than Disney Channel or Netflix). And you can only publish it in TestFlight for internal use. Apple will only do the automatic check of your app, to see if you didn’t use any private API calls and a few other things, and even point out bugs if they find any.
If you want to actually publish your app, you will have to go through all the hoops.
I don’t agree with charging *any* amount to be able to practically use your code on your own device.
Not sure what disney channel or netflix have to do with app development?
Maybe you _can_ write apps for disney channel and netflix, but even if you can, there’s no way i’d pay a hundred bucks for the privilege.
Early on (2011+) the only OS and hardware that reliably supported BLE was iOS and the iPhone 4S and later. I was working at several IoT startups (which are household names now) in the years following that, and we could reliably get our apps working on iOS and usually struggled with Android. Subtle differences in the BLE driver stacks for major Android phones would (no exaggeration) break our product experience from one brand to the next. We were always able to build our apps with just Apple’s documentation, so perhaps there was never much need for 3rd-party tutorials over the following years?
This is correct. BLE on iOS was and still is ahead of Android Studio. IMO. They wanted to provide an alternative to BT Classic and move from system space to user space. But the article is correct in that Apple no longer provides useful example code on its developer web site. Maybe Apple wants to channel “hobbyists” into Swift Playgrounds. But there comes a time when you are through playing and actually want to build something.
Awesome… (just too late unfortunately)
I find using an Esp32 as a web server GUI to Ble bridge works great for stationary hobby projects.
Kind of unrelated but does anyone here find BLE (and Bluetooth classic for that matter) janky? I’ve never had a positive experience while developing bluetooth enabled apps on android. It seems like their example own code doesn’t work sometimes. Plus the callback hell.
Developing BLE stuff on hardware side (BLE enabled MCUs) has been alright, much more tolerable.
Using Bluetooth tech in the form of headphones, gamepads etc has been good for me but nowhere as reliable as I would like things to be.
Get a Bluetooth USB dongle that has software to explore all services and attributes. Use it to explore all the Bluetooth devices that you usually use with your phone and then you will better understand it and why it’s so Janky and more importantly, how to write code that is more predictable in its behavior.
Exactly. A radio circuit is not a wire.
It’s mostly due to crappy PC/phone side BLE hardwares that are just tweaked to pass conformance tests and nothing else…
And yes conformance test are not enough for real life use.
By the way: that code could do with some separation of responsibilities.
Why is all the BLE handling code in the ViewController? And why is the ViewController code not split into a ViewController and a ViewModel?
I also think that there are two more reason why there are comparatively more tutorials for Android than for iOS.
1. Cheap Android hardware, which makes Android more suitable for the hobbyist, and thus begets many more tutorials from beginner developer.
2. More ways to do it wrong on Android, which causes incompatibilities that make your app run on some hardware and not on other, and thus begets many more tutorials from developers trying to show how to do it right.
My two cents.
Would like to see a Bluefruit Connect for the ESP32. There must be a great demand for such app on iPhone,