Getting Started - iOS

Requirements

The Socket Mobile Capture SDK uses Bluetooth Classic through the External Accessory framework for the barcode scanner products and Bluetooth Low Energy (BLE) for the Contactless Reader/Writer products (Such as the Socket Mobile D600 and S550).

For applications that need to work with barcode scanners, make sure the following requirements are met:

  1. Your application needs to be registered in our whitelist before submitting your application to the Apple Store. It will not pass the Apple Store review if this is not done.

  2. Your application must have the string com.socketmobile.chs in the Supported External Protocol setting.
    ExternalAccessory

  3. Your application’s Info.plist MUST have the NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data. This is an iOS/Apple requirement for applications that use the CoreBluetooth framework. Without it, your application will crash with a message in the Xcode console explaining that you must add the description key. Additionally, if your application has a deployment target earlier than iOS 13.0, you will need to add NSBluetoothPeripheralUsageDescription along with the NSBluetoothAlwaysUsageDescription. More information can be found here in the official Apple Documentation

  4. Your application will need a SocketMobile AppKey. Follow the link to create an AppKey. AppKeys can be generated online and at no additional cost beyond the nominal registration fee. The AppKey is validated by the SDK library on the device, no internet connection is required. Note: You don’t need to create your own AppKey to compile and run the sample apps.

  5. The scanner needs to be paired with your devices in Application Mode. This can be done using Socket Mobile Companion app (recommended), which can be downloaded from the App Store . To pair your scanner in Application Mode without using Companion app, follow the instructions at: ConfigureInAppMode.

  6. Try a sample app. Depending on your choice of language, you can try either the Single Entry in Swift or Single Entry in Objective C.

SDK Installation

The SDK is released as a NuGet package named SocketMobile.Capture. The NuGet package lies in a private GitLab package registry. Here you will find information on methods on how you can access the NuGet.

The Capture SDK NuGet depends on JSON NuGet from Newsoft that will get installed as well.

An application using the Socket Capture SDK needs to be registered in order to retrieve an AppKey that is required by the Capture API. You can register for an app key on the Socket Mobile Developer portal. Note you will have to log in to create an App Key.

Register to the Feed

The Package Registry will allow the user to have access to all packages and not just the most recent. To register to the package feed, you can use the following command line:

nuget source Add -Name "<package_source_identifier>" -Source "https://sdk.socketmobile.com/api/v4/projects/9/packages/nuget/index.json" -UserName <your_username> -Password <your_token>

<package_source_identifier>: An identifier of your choosing, e.g. “SecureRepo”. <your_username>: The provided Token identification. <your_token>: The provided Token.

You can also use a NuGet.config file. Either edit the global file or create a new one in the same directory of your solution to register to the package feed:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
            <add key="<package_source_identifier>" value="https://sdk.socketmobile.com/api/v4/projects/9/packages/nuget/index.json" />
    </packageSources>
    <packageSourceCredentials>
            <<package_source_identifier>>
                    <add key="Username" value="<your_username>" />
                    <add key="ClearTextPassword" value="<your_token>" />
            </<package_source_identifier>>
    </packageSourceCredentials>
</configuration>

Get the NuGet Package

Once registered, two main options can be used to get the NuGet package.

From your project’s directory, using the command line:

nuget install SocketMobile.Capture.Xamarin.iOS -Source "<package_source_identifier>"

Or directly using Visual Studio as you would with a NuGet from nuget.org. However, make sure that you have selected the newly added feed from the Package Manager.