Using the Zebra Link-OS SDK XCFramework in Xcode using Objective-C
This article shows you how to build a sample application that utilizes the Zebra Link-OS SDK XCFramework. We will manually install the XCFramework and confirm that it is running using one of the sample applications provided by Zebra.
Prerequisites
Xcode
Before we begin you will need to have Xcode installed (I am using version 15.3 at the time of writing this article).
Zebra Link-OS SDK
You will need to download the SDK:
https://www.zebra.com/us/en/support-downloads/software/printer-software/link-os-multiplatform-sdk.htm
When you unzip the download you will find the SDK in the following location where you will find 2 folders to provide options for the install:
zebra-linkos-mpsdk-jun-2024/iOS/v1.6.1130/lib
- FATLib
- xcframework (We will be using the xcframework folder.)
Zebra iOS Samples
Clone the sample code from git provided by Zebra:
https://github.com/ZebraDevs/LinkOS-iOS-Samples/tree/ZSDK_DevDemos/ZSDK_DevDemos
Note: There are several other samples provided by Zebra, we will be demonstrating the [ZSDK Dev Demos] sample today, but you may also be interested in the others:
https://github.com/ZebraDevs/LinkOS-iOS-Samples
Prepare the Workspace
Open the downloaded project by double clicking on the
ZSDKDeveloperDemos.xcodeproj
file.
In Xcode:
- In the project navigator: Delete the Frameworks/libZSDK_API.a file.
- In the project navigator: Delete the Resources/Images/Images reference.
- Change iOS deployment target to at least iOS 13.0. This is because the demo application is older and the current Xcode will not support it.
- Project Signing & Capabilities, change the Team to use your Apple Developer account.
- Update the bundle identifier to use your domain.
Adding the XCFramework
- In Xcode, in the project navigator, open the Frameworks folder.
- In Finder, navigate to the folder that you extracted the SDK (zebra-linkos-mpsdk-jun-2024/iOS/v1.6.1130/lib/xcframework).
- Copy the
ZSDK_API.xcframework
folder from Finder into the Frameworks folder within Xcode.
During the copy, you will be prompted to answer a few questions:
- Destination: Copy items if needed
- Added Folders: Create groups
- Add to targets: ZSDKDeveloperDemos
Once you copy the XCFramework you will see it listed in the
Link Binary with Libraries in the
Build Phases.
Build and Run the application
You should now be able to
build the application successfully. But, you won't be able to
run it yet.
Change your target device to an emulator and try to run it. You will encounter one final error:
The application's Info.plist does not contain a valid CFBundleShortVersionString.
So, let's do as the compiler says and add it to the
ZSDKDeveloperDemos-Info.plist file. The
CFBundleShortVersionString
is represented with the
Bundle version string (short)
in the property list.
Now you will be able to
build and
run the application on the simulated iPhone 15.
Congratulations! It's running! Now that you're passed the harderst part, setting it up, you could actually look at the code to see all the features the SDK has to provide.
The samples are written in Objective-C, which I'm not a fan of, only because I'm not well versed in it, so keep an eye out for my future article to use the SDK with Swift UI.