Hi,
I'm no Obj-C developer, but I need to use it when interacting with the Zebra barcode scanner API. I have created a brdging header which works, but I can get this function to return any data.
swift
func sbtGetAvailableScannersList(_ availableScannersList: AutoreleasingUnsafeMutablePointerNSMutableArray?!) - SBT_RESULT
I read on stackoverflow that I can declare it like this:
swift
var availableScanners: NSMutableArray?
scanner?.sbtGetAvailableScannersList(&availableScanners)
if let _scanners = availableScanners {
for scanner in _scanners {
if let scanner = scanner as? SbtScannerInfo {
listOfScanners.append(scanner)
}
}
}
but the array is always nil. These is a delegate method that fires whenever a scanner get available, and it works, so I know that at least in theory, the array should contain that scanner.
This is the Obj-C implementation in the demo.app provided by Zebra
Objective-C (void)fillScannersList:(NSMutableArray**)list
{
NSMutableArray *available = [[NSMutableArray alloc] init];
NSMutableArray *active = [[NSMutableArray alloc] init];
if (m_DcsSdkApi != nil)
{
if ([m_DcsSdkApi sbtGetAvailableScannersList:&available] == SBT_RESULT_FAILURE)
{
dispatch_async(dispatch_get_main_queue(),
^{
[self showMessageBox:@"Search for available scanners has failed"];
}
);
}
[m_DcsSdkApi sbtGetActiveScannersList:&active];
/* nrv364: due to auto-reconnect option some available scanners may have
changed to active and thus the same scanner has appeared in two lists */
for (SbtScannerInfo *act in active)
{
for (SbtScannerInfo *av in available)
{
if ([av getScannerID] == [act getScannerID])
{
[available removeObject:av];
break;
}
}
}
if ((list != nil) && (*list != nil))
{
[*list removeAllObjects];
[*list addObjectsFromArray:available];
[*list addObjectsFromArray:active];
}
}
[available release];
[active release];
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hi!
I'm trying to create a button similar to the reminders app when you press the "Where" button and can choose "At home", "When I leave" etc, or at least something slightly similar.
I know I can easlity create a button and a label, but to get correct tinting when selected, It would be easier to just have button.
I found this post on - https://stackoverflow.com/a/41567531/12877341 stack overflow, but even though I use the same values, I don't get the same results. My image (SF Symbol) are squeezed and not filled 50x50 with text below.