Posts

Post marked as solved
2 Replies
644 Views
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]; }
Posted
by perage.
Last updated
.
Post not yet marked as solved
1 Replies
2.4k Views
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.
Posted
by perage.
Last updated
.
Post not yet marked as solved
0 Replies
206 Views
Hi, I have an app with one TabBarController and four tabs. In each tab there's two containerViews which most of them have a navigationController and ViewController. My issue is that if my first tab has a custom navigationBar of type myNavigationBar and i then move to another tab that doesn't, that NavigationBar implicitly gets the same type. Is this how it is supposed to be, or have I structured the app in a "wrong" way?
Posted
by perage.
Last updated
.
Post not yet marked as solved
0 Replies
371 Views
Hi, I'm creating a POS app and need to create a receipt to be printed on a thermal/BT printer or sent by mail. I've searched a lot for it, but searching for "Swift" & "Receipt" often results in app store receipt validation. Can anyone point me to a tutorial that covers something like this, or a CocoaPod that could work? Thanks in advance!
Posted
by perage.
Last updated
.
Post not yet marked as solved
0 Replies
259 Views
Hi,I'm fairly new to Swift and Xcode, but have come so far that I have managed to create my first app. It's a somewhat complicated app with a few storyboards, 10-15 VC's. Over the last weeks I have deployed the app to my iPhone and after a few days of testing, the app usually crashes, making it stop loading again unntil I rebuild it from Xcode. Yesterday I added Firebase to my app and after deploying it to my iPhone again, I created a FB record and changed another one. Now, that record won't load from FB even If i close the app on my iPhone and start it again. Running it in the simulator, It fetches the record just fine - and that without any changes to code. Creating a new record today on my iPhone works, and it shows in FB, but not the changed one from yesterday.So - is running the app on my phone not as stable as using the simulator? I haven't come that far as learing about app life cycle management, so I might have missed some basics regarding that...?
Posted
by perage.
Last updated
.
Post not yet marked as solved
1 Replies
343 Views
Hi,I have an app that I have installed on my device from Xcode using Run. It works for a while after installing it, then suddenly one day it crashes. Is there any way to connect my iPhone to Xcode at get the reason (i.e crashlog)
Posted
by perage.
Last updated
.
Post marked as solved
1 Replies
261 Views
Hi,I have a tableView where I have configured some actions. One of them is to scan or input a serial number for a cart Item. The flow goes like this:trailingSwipeActionalertController ask if user wants to use keyboard og barcode scanner Barcode -> calls barecode scanner to start scanning --> scan received --> update model[indexPath.row]Keyboard --> new alertController asking for input --> input received --> update model[indexPath.row]Reload cellWhat is the best approach to acheive the model update? Is seems most correct to extend all method calls to pass forward the model instance at the correct index, but it's also cumbersome. A far easier approach is to have a variable in the ViewController as "selected row" and use that as the index whenever I need it. But again, that could easily fall out of sync if I forget to update it one place.
Posted
by perage.
Last updated
.
Post marked as solved
2 Replies
360 Views
Hi,How can I create a tableViewCell with a lot of elements, but having the cell increase/decrease height dependent on which elements that are present?I.e: I always have an image and a title, but I could also have subtitle, tags, an icon + +. If I only have image and title, I want the title to be aligned to the center of the image, and the cell to be e.g 80 height. But If I have subtitle and tags, I want the height to be higher and the title to align to the top line of the image with tags and subtitles below.
Posted
by perage.
Last updated
.
Post not yet marked as solved
4 Replies
779 Views
Hi,I have a tableView with sections for different OrderItemTypes, and in each row I have a swipe action to change type. What I'm trying to acheive is to reload the data after changing a type, so that the row changes section. As only necessary sections are created when the table is filled the first time, moving rows aren't a viable solution.I have a tableview with a swipe action, which then calls an actionController. I'm trying to update the tableView after choosing an action from the action sheet, but I don't understand where to put the tableview.reloadData() call.struct cartViewModel { static func trailingSwipeActionsFor(_ item: orderItem, viewController: UITableViewController ) -> UISwipeActionsConfiguration? { var actions = [UIContextualAction]() let switchTypeAction = UIContextualAction(style: .normal, title: nil) { (_,_,success) in let ac = UIAlertController(title: "Change type", message: nil, preferredStyle: .actionSheet) for type in orderItem.orderItemType.allValues where type != item.type { ac.addAction(UIAlertAction(title: "\(type.prettyName)", style: .default, handler: handleChangeType(item: item, type: type))) } ac.addAction(UIAlertAction(title: "Cancel", style: .cancel)) viewController.present(ac, animated: true) success(true) } switchTypeAction.backgroundColor = UIColor.preferredFioriColor(forStyle: .accent10b) nfigureAction.image = FUIIconLibrary.map.marker.job actions.append(configureAction) } let swipeActions = UISwipeActionsConfiguration(actions: actions) swipeActions.performsFirstActionWithFullSwipe = false return swipeActions } static func handleChangeType(item: orderItem, type: orderItem.orderItemType) -> (_ alertAction:UIAlertAction) -> (){ return { alertAction in item.type = type } }I've tried to call it in "didEndEditingRowAt" and after call to "viewController.present(ac, animated: true)" (line 15 above), but none works. the call to present(ac, animated: true) seems also to be executed aync after "success(true)".
Posted
by perage.
Last updated
.