Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit bffa511

Browse files
authored
Fix threading issue when NFC scan times out (#387)
- #385
1 parent 9b78d01 commit bffa511

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ios11/NFCTagReader/NFCTagReader/MessagesTableViewController.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ public void DidInvalidate(NFCNdefReaderSession session, NSError error)
7373
if (readerError != NFCReaderError.ReaderSessionInvalidationErrorFirstNDEFTagRead &&
7474
readerError != NFCReaderError.ReaderSessionInvalidationErrorUserCanceled)
7575
{
76-
77-
var alertController = UIAlertController.Create("Session Invalidated", error.LocalizedDescription, UIAlertControllerStyle.Alert);
78-
alertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
79-
DispatchQueue.MainQueue.DispatchAsync(() =>
80-
{
81-
this.PresentViewController(alertController, true, null);
76+
BeginInvokeOnMainThread (() => {
77+
var alertController = UIAlertController.Create ("Session Invalidated", error.LocalizedDescription, UIAlertControllerStyle.Alert);
78+
alertController.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Default, null));
79+
PresentViewController (alertController, true, null);
8280
});
8381
}
8482

0 commit comments

Comments
 (0)