StarXpand SDK for iOS
is a software development kit for supporting application development for Star Micronics devices.
This software development kit provides the StarIO10 framework (StarIO10.xcframework) as a framework to control the Star Micronics devices.
In accordance with Apple's guidelines, StarIO10 V2.6.1 or later includes a privacy manifest file. Please see here for the Manifest file. However, StarIO10 does not use the Required Reason API from the first release. (As of January 29, 2024)
Please refer here for StarXpand SDK documentation.
Documentation includes an overview of the SDK, how to build a sample application, how to use the API, and a API reference.
Language | Language Version | Platform | OS Version | Arch |
---|---|---|---|---|
Swift | 5 | iOS | iOS 13.0 or later | Device: arm64 Simulator: arm64, x86_64 |
In order to integrate the StarIO10 framework into your iOS application, Use Swift Package Manager.
- In Xcode, select
File
menu >Add Packages...
. - Enter
https://github.com/star-micronics/StarXpand-SDK-iOS
in the URL input field. - Select
StarXpand-SDK-iOS
and pressAdd Package
button.
For more information on how to integrate Swift Package, please refer to the following URL.
https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app
Some settings and approvals are required depending on the printer interface.
Please check the table below and take action.
Interface of the printer | Necessary actions |
---|---|
Bluetooth | 2.1. & 2.2. & 2.4. |
Bluetooth Low Energy | 2.2. |
Ethernet (iOS14 or later) | 2.3. |
Lightning USB | 2.1. & 2.4. |
- Click on the information property list file (default : “Info.plist").
- Add the
Supported external accessory protocols
Key. - Click the triangle of this key and set the value for the “Item 0" to
jp.star-m.starpro
.
⚠️ If you do not use the printer concerned, do not configure this setting.
- Click on the information property list file (default : “Info.plist").
- Add the
Privacy - Bluetooth Always Usage Description
Key. - If you set
Deployment Target
to iOS12, add thePrivacy - Bluetooth Peripheral Usage Description
Key. - Set the reason for using Bluetooth in Value (e.g.
Use Bluetooth for communication with the printer.
) - When communicating with the Bluetooth printer on iOS 13 or later, an alert requesting permission to access Bluetooth is displayed. The string set in Value is displayed in the alert as the reason for using Bluetooth.
For more information, please refer to the following URL.
- Click on the information property list file (default : “Info.plist").
- Add the
Privacy - Local Network Usage Description
Key. - Set the reason for using Local Network in Value (e.g.
Use Local Network for communication with the printer or discovery the printers.
) - When communicating with the Ethernet printer on iOS 14 or later, an alert requesting permission to access Local Network is displayed. The string set in Value is displayed in the alert as the reason for using Local Network.
In order to offer your application that communicates a MFi certified printer on the Apple iTunes App Store, your application needs to be approved by the Apple MFi program before you submit it to the Apple iTunes App Store. Please follow the steps described in the URL below to obtain the app approval. This procedure must be completed before the app is reviewed by Apple.
https://star-m.jp/eng/products/s_print/apple_app_mfi.html
⚠️ In case of a Bluetooth Low Energy printer, you do not need to obtain this app approval.
StarXpand SDK includes an example application that can be used in combination with the printer to check its operation. Please use it in conjunction with the explanations of each function in the linked pages.
The sample code and printed result images are also available here.
- Sample to create print layouts for receipts and labels for each type of business
- Sample to generate receipt images from text data
⚠️ Some printer models may not be able to print some samples. Please adjust the layout accordingly when using this samples.
func getStatus() {
// Specify your printer connection settings.
let starConnectionSettings = StarConnectionSettings(interfaceType: .lan,
identifier: "00:11:62:00:00:00")
let printer = StarPrinter(starConnectionSettings)
Task {
do {
// Connect to the printer.
try await printer.open()
defer {
Task {
// Disconnect from the printer.
await printer.close()
}
}
// Get printer status.
let status = try await printer.getStatus()
print(status)
} catch let error {
// Error.
print(error)
}
}
}
var printer: StarPrinter?
func monitor() async {
// Specify your printer connection settings.
let settings = StarConnectionSettings(interfaceType: .lan,
identifier: "00:11:62:00:00:00")
printer = StarPrinter(settings)
guard let printer = printer else {
return
}
printer.printerDelegate = self
printer.drawerDelegate = self
printer.inputDeviceDelegate = self
printer.displayDelegate = self
Task {
do {
// Connect to the printer.
try await printer.open()
} catch let error {
// Error.
print(error)
}
}
}
// Callback for printer state changed.
func printerIsReady(_ printer: StarPrinter) {
print("Printer: Ready")
}
func drawer(printer: StarPrinter, didSwitch openCloseSignal: Bool) {
print("Drawer: Open Close Signal Switched: \(openCloseSignal)")
}
func inputDevice(printer: StarPrinter, didReceive data: Data) {
print("Input Device: DataReceived \(NSData(data: data))")
}
func displayDidConnect(printer: StarPrinter) {
print("Display: Connected")
}
// ...
// Please refer to document for other callback.
Copyright 2022 Star Micronics Co., Ltd. All rights reserved.