Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 16 needs restoreStateIdentifier specification and has Error 103 issue #15

Open
Aldaniee opened this issue Nov 6, 2022 · 2 comments · May be fixed by #16 or #17
Open

iOS 16 needs restoreStateIdentifier specification and has Error 103 issue #15

Aldaniee opened this issue Nov 6, 2022 · 2 comments · May be fixed by #16 or #17

Comments

@Aldaniee
Copy link
Collaborator

Aldaniee commented Nov 6, 2022

I was working on updating the example project to run iOS 14 by adding the following to Runner/Info.plist

	<key>NSBonjourServices</key>
	<array>
		<string>_dartobservatory._tcp</string>
	</array>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>The app uses bluetooth to find, connect and transfer data between different devices</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>The app uses bluetooth to find, connect and transfer data between different devices</string>
    <key>UIBackgroundModes</key>
    <array>
    <string>bluetooth-central</string>
    </array>

And in ergblemanager.dart I added a restoreStateIdentifier.

  Future<void> init() async {
    await _manager.createClient(restoreStateIdentifier: "example-restore-state-identifier");
  }

Now the error I'm stuck on is the following:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: BleError (Error code: 103, ATT error code: null, iOS error code: null, Android error code: null, reason: Reason not provided, internal message: null, device ID: null, service UUID: null, characteristic UUID: null, descriptor UUID: null)

Error 103

@Aldaniee Aldaniee changed the title iOS 14 needs restoreStateIdentifier specification iOS 16 needs restoreStateIdentifier specification and has Error 103 issue Nov 6, 2022
@MoralCode
Copy link
Collaborator

Thanks for finding these! feel free to submit a PR to make those changes to the Info.plist.

Error 103 seems interesting. id be curious as to if it means bluetoth is literally in a state called "unknown", or if that error means bluetooth doesn't know what state its in or cant find out. Is bluetooth turned on on the device you are testing with?

@Aldaniee
Copy link
Collaborator Author

Aldaniee commented Nov 7, 2022

The issue came from startErgScan() being called before init() in ergblemanager.dart.

The fix I found was to make init() async and in main.dart to call the async functions in a synchronous way:

  @override
  void initState() {
    super.initState();
    unawaited(
      bleManager.init().then((_) => startScan()),
    );
  }

@Aldaniee Aldaniee linked a pull request Nov 7, 2022 that will close this issue
@MoralCode MoralCode linked a pull request Nov 16, 2022 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants