1. Apple Installation

MetaSensors supports iOS, macOS, tvOS and watchOS.

Please ensure you are running the latest macOS on a desktop or laptop.

Mac developers can create Apps for iPads, iPhones, Watches and Mac desktops/latops. Any App you develop with our APIs can be released on the Apple App store.

Warning

Bluetooth Low Energy support is limited on Mac devices. The Xcode simulator DOES NOT support Bluetooth so you must ensure that the end device for which you are developing your App (such as an iPhone) supports BLE 4.0+.

As you go through this Apple tutorial, you will learn how to stream and log sensor data from MetaSensors using Swift and Xcode.

Note

We support Swift development on Apple devices that run Xcode. Other languages (such as Python) are not supported as there is no Bluetooth library available.

1.1. Pre-Installation

Ensure that you are running the latest OS:

  1. Visit the macOS page on the App Store or online: https://www.apple.com/macos/
  2. Click the download button and follow the onscreen instructions to begin your upgrade.
_images/apple-version-1.png

1.1.1. Bluetooth

Make sure your device support Bluetooth 4.0+

If the Bluetooth preferences lists options for enabling Bluetooth and making your device discoverable, Bluetooth is installed.

To check your Mac Bluetooth version:

  1. Click on the Apple menu.
  2. Select About This Mac.
  3. Click on the More Info button.
  4. Click on the System Report button.
  5. Select Bluetooth from the sidebar on the left, underneath “Hardware.”
  6. Scan down the list of information until you find “LMP Version.”

If your Mac is equipped with Bluetooth 4.0, LMP Version will say 0x6 (or higher). Anything lower than that is an older version of Bluetooth.

_images/apple-version-2.png

Warning

The Bluetooth version on your MAC will only be useful if you are developing a MAC App. If you are developing a Watch, iPad, and iPhone App, you must make sure that the device you are using for debugging supports Bluetooth 4.0 or later.

The following devices are compatible with wireless Bluetooth LE (4.0) connectivity:

  • iOS 8.12+ (With the exception of iOS 9 beta)
  • iPad Mini
  • iPad 3 (or later)
  • iPhone (4S or later)
  • iPod touch (5th Gen or later)
  • Mac OSX 10.10 (Yosemite)

The following Mac Models and later support BLE 4.0:

  • Mac mini - Mid 2011
  • MacBook Air - 2011
  • MacBook Pro - Late 2012
  • iMac - Late 2012
  • Mac Pro - Late 2013 / early 2014

Minimum Watch model recommendation:

  • WatchOS 5 and Apple Watch Series 4

1.2. Installation

This tutorial will take you through all of the tools you need to install to develop with MetaSensors on Apple OSs.

1.2.1. Xcode

Xcode is an integrated development environment for macOS containing a suite of software development tools developed by Apple for developing software for macOS, iOS, watchOS and tvOS.

Download and install it from the App Store or from Apple’s website: https://developer.apple.com/xcode/

It will prompt you to create a developer account. Follow the steps from Apple.

_images/xcode.png

1.3. Optional

1.3.1. Terminal

The Terminal app allows you to control your Mac using a command prompt. You should get comfortable with the command line and basic commands.

The Terminal app is in the Utilities folder in Applications.

To open it, either open your Applications folder, then open Utilities and double-click on Terminal, or press Command - spacebar to launch Spotlight and type “Terminal,” then double-click the search result.

_images/apple-version-4.png

1.3.2. Homebrew

Homebrew is an essential tool for any developer.

Before you can run Homebrew you need to have the Command Line Tools (CLT) for Xcode installed. CLT includes compilers that will allow you to build things from source, and if you are missing this it’s available through the App Store > Updates.

You can also run the following command to see if CLT is installed:

>>> xcode-select -p

This will return the path to the tool if the CLT is already installed: /Applications/Xcode.app/Contents/Developer.

_images/apple-version-6.png

To install Homebrew run the following:

>>> /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Hit Enter, and follow the steps on the screen.

Add /usr/local/bin to your PATH environment variable:

>>> echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

Alternatively, you can also insert /usr/local/bin to the first line of /private/etc/paths and reboot the Mac to change global paths loading order. Your Admin password may be required if you modify the file.

To be able to use brew you need to start a new terminal session. After that you should make sure everything is working by running:

>>> brew doctor
_images/apple-version-5.png

1.3.3. Git

Type the following command into your Terminal:

>>> git --version
_images/apple-version-3.png

If it is already installed, you don’t need to do anything, otherwise read and agree to the Command Line Tools License Agreement and you are ready to use Git!

If the terminal install did not succeeed, you can install Git from this site: https://git-scm.com/download/mac

Another option is to use homebrew:

>>> brew install git

When done, test that it installed properly installed by running:

>>> git --version

Git should output /usr/local/bin/git.

Don’t forget to define your Git user (should be the same name and email you use for Github, Bitbucket or whichever repository you are using):

>>> git config --global user.name "Your Name Here"
>>> git config --global user.email "your_email@youremail.com"

They will get added to your .gitconfig file.

You can learn more about how to use Github on their website: https://guides.github.com/.

1.3.4. RubyGems

RubyGems, the Ruby package manager, should be installed on your machine. If you previously have installed Ruby; verify this by running:

>>> which gem

To update to its latest version with:

>>> gem update --system
_images/apple-version-7.png

To install a gem (Ruby package), run:

>>> gem install <gemname>

To install without generating the documentation for each gem (faster):

>>> gem install <gemname> --no-document

List installed gems:

>>> gem list
_images/apple-version-8.png

To check if any installed gems are outdated:

>>> gem outdated

To update all gems or a particular gem:

>>> gem update [<gemname>]

RubyGems keeps old versions of gems, so feel free to do some cleaning after updating:

>>> gem cleanup

1.3.5. CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 55 thousand libraries and is used in over 3 million apps.

You can learn more about CocoaPods here: https://cocoapods.org/

CocoaPods is built with Ruby and is installable with the default Ruby available on OS X. We recommend you use the default ruby.

Using the default Ruby install can require you to use sudo when installing gems:

>>> sudo gem install cocoapods
_images/apple-version-9.png

1.3.6. Simulator

Warning

BLUETOOTH IS NOT SUPPORTED IN THE SIMULATOR.

You will need to compile your App and test it on the native machine you are developing for as Bluetooth is not supported in the Xcode simulator.

_images/apple-version-0.png

1.4. Deployment

_images/app-developer.png

1.4.1. Developer Program

Developing for Apple and releasing Apps on the App store requires a Developer account. Please follow the directions on the Apple website: https://developer.apple.com/

_images/xcode-7.png