diff --git a/.gitignore b/.gitignore index e43b0f9..59c8462 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +*xcuserdata* .DS_Store diff --git a/Near.xcodeproj/project.xcworkspace/xcuserdata/logancautrell.xcuserdatad/UserInterfaceState.xcuserstate b/Near.xcodeproj/project.xcworkspace/xcuserdata/logancautrell.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100755 index 8adf0fc..0000000 Binary files a/Near.xcodeproj/project.xcworkspace/xcuserdata/logancautrell.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Near.xcodeproj/xcuserdata/logancautrell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Near.xcodeproj/xcuserdata/logancautrell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100755 index fe2b454..0000000 --- a/Near.xcodeproj/xcuserdata/logancautrell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/Near/MainViewController.swift b/Near/MainViewController.swift index 2eba20d..7f4674a 100755 --- a/Near/MainViewController.swift +++ b/Near/MainViewController.swift @@ -53,6 +53,17 @@ extension MainViewController: NFCProtocol { */ public func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { print("\(error)") + + // 204 is a raised when a single read is completed. + guard let err = error as? NSError, err.code != 204 else { + return + } + DispatchQueue.main.async { + let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert) + let action = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(action) + self.present(alert, animated: true, completion: nil) + } } /*! @@ -79,8 +90,7 @@ extension MainViewController: NFCProtocol { * @discussion Gets called when the NFC reader session has become active. RF is enabled and reader is scanning for tags. * The @link readerSession:didDetectTags: @link/ will be called when a tag is detected. */ - public func readerSessionDidBecomeActive(_ session: NFCReaderSession) - { + public func readerSessionDidBecomeActive(_ session: NFCReaderSession) { print("readerSessionDidBecomeActive") } @@ -92,8 +102,7 @@ extension MainViewController: NFCProtocol { * * @discussion Gets called when the reader detects NFC tag(s) in the polling sequence. */ - public func readerSession(_ session: NFCReaderSession, didDetect tags: [NFCTag]) - { + public func readerSession(_ session: NFCReaderSession, didDetect tags: [NFCTag]) { print("didDetect tags: \(tags)") } } @@ -137,7 +146,6 @@ extension MainViewController : UITableViewDelegate { } } - extension Substring { func toString() -> String { return String(self)