For iOS, the SDK (CirrentSDK.framework) is delivered as an embedded binary, built in Swift 3.1 using xcode 8.3. To add the framework to your Xcode project, go to your project settings, scroll down to "Embedded Binaries", select "Add Other" and add the CirrentSDK.framework file. Then in your project just add the following line to your source:
In Swift: import CirrentSDK
Objective-C: @import CirrentSDK
Along with the Cirrent SDK, we will provide you with the source code to a sample application that uses the Cirrent SDK to onboard a device onto the user's private Wi-Fi network (Cirrent-iOS.zip).
iOS Sample Application
The Cirrent iOS sample application is written in Swift 3.1, and provided in source code form to help you while you are modifying your app to incorporate the Cirrent SDK. The Cirrent sample app shows the on-boarding flow for a typical connected product, and also shows how you can use the Cirrent SDK to manage the connected products associated with your user's account.
The main areas of functionality that you should look at are:
- Controllers - these are the screens for the sample app
- LoginController - this is the first screen where the user logs in. You should replace this with a login to your cloud.
- AddDeviceController - this is the screen where the user searches for nearby unclaimed devices of the correct type that have been powered on recently
- SelectDeviceController - this is the screen where the user is shown the list of nearby unclaimed devices. The user selects the one they wish to claim.
- SetupDeviceController - this is the screen where the user is shown the options to setting up their device. Their broadband provider may have credentials for this private network, or the user may need to enter the private network credentials manually.
- ConfigureNetworkController - this is the screen where the user selects their private network and enters the pre-shared key.
- ConnectingController - this is the screen where the user is given status updates as the device joins their private network.
- SuccessController - this is the screen that is shown when the device has successfully joined the user's private network. This screen will typically be replaced with the main screen for your connected product.
- GoToSoftAPController - this is the screen that is shown when the device cannot be found via the cloud, and the user needs to move their phone over to the SoftAP network.
- ManageDevicesController - this is the screen that shows the devices already associated with this user's account
- ManageNetworksController - this is the screen where the user can see the private networks already configured in their device.
- AddNetworkController - this is the screen where the user can add a new network to a device already associated with their account.
- MenuController - the sample app has a menu to let the user go to the home screen, or configure some settings for the sample app.
- ConfigurationController - this screen lets the user change some configuration settings for the sample app (note: a production app is very unlikely to need to change any of these settings).
- SampleCloudService - this is an example of a cloud that will issue tokens to authorize the app to call the Cirrent service. The sample cloud also keeps track of which devices have been bound to the user's account. You should replace the Sample Cloud service with calls to your cloud.
If you wish to build the sample app, you will need to install CocoaPods, using the following commands:
sudo gem install cocoapods
CocoaPods is required for SDWebImage, JDProgressHUD (which are used in the Cirrent-iOS sample app). CocoaPods is not used by the CirrentSDK.