Skip to content

PluginController.swift:106: Assertion failed #387

@farr64

Description

@farr64

Describe the bug
PluginController.swift:106: Assertion failed

This started happening immediately upon upgrading to Xcode 13.

To Reproduce
Steps to reproduce the behavior:

  1. Connect to one device using connectToAdvertisingDevice()
  2. Subscribe to a qualified characteristic
  3. Observe a failure with exception (including the part of the stack trace, belonging to this package)
reactive_ble_mobile/PluginController.swift:106: Assertion failed
reactive_ble_mobile/PluginController.swift:106: Assertion failed
* thread #1, queue = 'com.apple.main-thread', stop reason = Assertion failed
    frame #0: 0x000000018f287060 libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`_swift_runtime_on_report:
->  0x18f287060 <+0>: ret    
libswiftCore.dylib`_swift_reportToDebugger:
    0x18f287064 <+0>: b      0x18f287060               ; _swift_runtime_on_report
libswiftCore.dylib`_swift_shouldReportFatalErrorsToDebugger:
    0x18f287068 <+0>: adrp   x8, 321903
    0x18f28706c <+4>: ldrb   w0, [x8, #0xfd1]
Target 0: (Runner) stopped.
Lost connection to device.

Expected behavior
No error, as was the case with Xcode prior to 13 (and as is the case with Android).

Smartphone / tablet

  • Any iOS device

Peripheral device

  • Nordic nRF52

Additional context

The iOS app was working before upgrading to Xcode 13.

I decided to change line 106 of
flutter_reactive_ble/packages/reactive_ble_mobile/ios/Classes/Plugin/PluginController.swift

from
else { assert(false); return }
to
else { }

and this made the iOS app work.

Obviously, "killing the messenger" is not ideal (given that the assertion is there for a reason) but, hey, . . .

The same Flutter app runs perfectly on Android.

pubspec.yaml:

name: xyz
description: XYZ

publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"
  flutter: ">=1.10.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  flutter_reactive_ble: ^4.0.1
  location_permissions: ^4.0.0
  typed_data: ^1.3.0
  intl: ^0.17.0

dev_dependencies:
  build_runner: ^2.1.2
  dependency_validator: ^3.1.0
  flutter_test:
    sdk: flutter

# The following section is specific to Flutter.
flutter:

  uses-material-design: true

Thanks for any guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingiOSiOS-specific ticket

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions