Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

"Session invalidated unexpectedly" on ios running example #60

Open
gavinheale opened this issue Aug 12, 2020 · 2 comments
Open

"Session invalidated unexpectedly" on ios running example #60

gavinheale opened this issue Aug 12, 2020 · 2 comments

Comments

@gavinheale
Copy link

Hi,

When I try to run the example in Xcode I get. the following error when hitting the "Toggle scan" button.

Any ideas why. Is it a permission problem because I am just Personal Team?

Regards,
Gavin

2020-08-12 16:46:24.833420-0400 Runner[49554:17014289] Metal API Validation Enabled
2020-08-12 16:46:24.957805-0400 Runner[49554:17014485] flutter: Observatory listening on http://127.0.0.1:57473/99vrNynKEpg=/
2020-08-12 16:46:32.017670-0400 Runner[49554:17014463] [CoreNFC] 00000002 83608500 -[NFCNDEFReaderSession beginSessionWithConfig:]:324 error:Error Domain=NFCError Code=202 "Session invalidated unexpectedly" UserInfo={NSLocalizedDescription=Session invalidated unexpectedly}, errorCode: 0xca
2020-08-12 16:46:32.029065-0400 Runner[49554:17014474] flutter: error: PlatformException(SessionTerminatedUnexpectedlyError, Session invalidated unexpectedly, null)

@MaslovD
Copy link

MaslovD commented Oct 20, 2020

Having same issue. Is that library still being maintained?

`flutter: error: PlatformException(SessionTerminatedUnexpectedlyError, Session invalidated unexpectedly, null, null)
flutter: error: PlatformException(SessionTerminatedUnexpectedlyError, Session invalidated unexpectedly, null, null)
flutter: error: PlatformException(SessionTerminatedUnexpectedlyError, Session invalidated unexpectedly, null, null)

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
setState() called after dispose(): _ReadExampleScreenState#afeb2(lifecycle state: defunct)

This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.

The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0 State.setState. (package:flutter/src/widgets/framework.dart:1208:9)
#1 State.setState (package:flutter/src/widgets/framework.dart:1243:6)
#2 _ReadExampleScreenState._stopScanning (package:nfc_master/read_example_screen.dart:48:5)
#3 _ReadExampleScreenState.dispose (package:nfc_master/read_example_screen.dart:64:5)
#4 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4854:12)
...
════════════════════════════════════════════════════════════════════════════════════════════════════`

@jeremyherbert
Copy link

This unhelpful error from iOS is because your entitlements/capabilities/permissions are not set up correctly. Note you must have a paid Apple developer membership to use this library on iOS; Apple only allows NFC access to paid tiers.

I have tested this on the latest iOS 14 as of today and it works fine with a paid account.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants