CocoaPods Support

The Nabto Edge Plain C Client SDK can be installed using CocoaPods, this is the simplest way to use Nabto Edge in an iOS app.

Note that only the Nabto Edge Plain C API is supported. An official higher level wrapper that supports Swift better will be available in Q3 2020.

For an introduction to CocoaPods and how to install the necessary prerequisites, please see the install guide on cocoapods.org.

Podfile

Add the following line to your Podfile to use the Nabto Edge Plain C Client SDK for iOS:

  pod 'NabtoEdgeClientApi'

Then run pod install:

$ pod install
Analyzing dependencies
Downloading dependencies
Installing NabtoEdgeClientApi (1.0.3)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

If this is the first pod you use in your Xcode project, you must close your project file and open the generated workspace instead.

A full example Podfile placed in the root directory of your project:

platform :ios, '11.0'

target 'NabtoEdgeDemo' do
  pod 'NabtoEdgeClientApi'
end

Code

To use the installed podfile, add the following to your source file:

#import "NabtoEdgeClientApi/nabto_client.h"

Now you can use the Plain C SDK:

self.versionLabel.text = [NSString stringWithCString:nabto_client_version()
                                            encoding:NSUTF8StringEncoding];

Troubleshooting

Do a pod repo update to get the latest podspec version if you have problems installing the desired version.

If you are impatiently waiting for a newly pushed update that does not seem possible to install (despite it appearing in pod search results and a repo update has been performed), it is likely due to the CDN introduced with Cocoapods 1.8+: Sometimes a significant delay has been observed when waiting for changes to be synchronized. To remedy this, you can temporarily add the old github source to the top of your Podfile:

source 'https://github.com/CocoaPods/Specs.git'