1. Xcode Installation

MetaSensors are supported on iOS, macOS, tvOS and watchOS.

For this tutorial, you will need Xcode on MAC OS. Our APIs are available in Swift.

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.

You should be familiar with the Swift language and know how to deploy Apps before starting the tutorial.

Warning

Other languages (such as Python) on MAC are not supported.

1.1. Requirements

Ensure that you are running the latest OS:

  1. Visit the macOS page on the App Store or online:

  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

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.

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

_images/xcode.png

1.3. Recommendation

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 a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system and Linux. 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:

>>> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
_images/apple-version-5.png

1.3.3. Git

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.

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.

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 Git on the respective sites.

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.

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

Xcode Simulator allows you to rapidly prototype and test builds of your app during the development process. Installed as part of the Xcode tools, Simulator runs on your Mac and behaves like a standard Mac app while simulating an iPhone, iPad, Apple Watch, or Apple TV environment.

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:

_images/xcode-7.png