Posts

Post not yet marked as solved
0 Replies
355 Views
I have an app that I want to extend with some CoreNFC tag reading.I initiate a tagReaderSession with this code, which brings up a system dialoge telling the phone is currently in read mode:_readerSession = [[NFCTagReaderSession alloc] initWithPollingOption:NFCPollingISO14443 delegate:self queue:nil] ; _readerSession.alertMessage = @"Bip the top of the phone towards a NFC tag."; [_readerSession beginSession];This method is called when a tag has been read:- (void)tagReaderSession:(NFCTagReaderSession *) session didDetectTags:(NSArray<__kindofid> *)tagsMy intended design:- I use NFC tags as sports timing chips and the phone as a reader station.- I would like to read many tags before invalidating the tag reader. Not just one tag and then closing down the session.=> This I can do- Between each tag read I would like to pop up a dialogue quickly, 2 seconds, with a message about the tag just scanned and a calculated time, position etc, in the race.=> Here I get a problem with threads.i.e:- It is hard to move or customize the standard tag reading message from the system.- it is hard to display something else at the same time. Everything else is gray appart from the system dialogue until the readerSession dialoge have been nvalidated.- Even first doing readerSession.invalidate and then calling UI methods does not work (bringing up an AlertController). I then get this error below:tagString = [tag.asNFCMiFareTag.identifier hexadecimalString]; [__viewController addResults:tagString]; [_readerSession invalidateSession]; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Result added" message:.......2020-03-13 17:48:29.410911+0100 Sportimes[3249:1471500] *** Assertion failure in -[FBSSerialQueue assertOnQueue], /BuildRoot/Library/Caches/com.apple.xbs/Sources/FrontBoardServices/FrontBoard-626.4.1/FrontBoardServices/FBSSerialQueue.m:98 2020-03-13 17:48:29.411179+0100 Sportimes[3249:1471500] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'I guess I need to go into threads.Any advice?
Posted
by evertee.
Last updated
.