dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
530 stars 194 forks source link

iOS simulator build failures #614

Closed toghi closed 2 years ago

toghi commented 2 years ago

I tryed to use the library on iOS and Android simulator in mac os. Everything is ok for Android. However, I can not even build on iOS simulator. I even tryed the entire project, I recieved errors during the build:

Xcode's output:
↳
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: error: value of optional type 'CBPeripheral?' must be unwrapped to a value of type 'CBPeripheral'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: coalesce using '??' to provide a default when the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          ?? <#default value#>
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          !
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: error: value of optional type 'CBPeripheral?' must be unwrapped to a value of type 'CBPeripheral'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: coalesce using '??' to provide a default when the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          ?? <#default value#>
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          !
    /Users/aa/Library/Developer/Xcode/DerivedData/Runner-flgparpnvurxgxgueyvpwhzrwwmo/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MultiplatformBleAdapter.build/Objects-normal/arm64/RetryWhen.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'MultiplatformBleAdapter' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: error: value of optional type 'CBPeripheral?' must be unwrapped to a value of type 'CBPeripheral'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: coalesce using '??' to provide a default when the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          ?? <#default value#>
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RestoredState.swift:68:105: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
                                                          peripheral: RxCBPeripheral(peripheral: $0.service.peripheral)),
                                                                                          ^
                                                                                          !
    /Users/aa/Library/Developer/Xcode/DerivedData/Runner-flgparpnvurxgxgueyvpwhzrwwmo/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MultiplatformBleAdapter.build/Objects-normal/arm64/Rx.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'MultiplatformBleAdapter' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/aa/Downloads/FlutterBleLib-develop/example/ios/Pods/MultiplatformBleAdapter/iOS/RxBluetoothKit/RxCBCharacteristic.swift:59:52: error: value of optional type 'CBService?' must be unwrapped to a value of type 'CBService'
            return RxCBService(service: characteristic.service)
                                                       ^
betterengineering commented 2 years ago

I was able to find a workaround here:

pod 'MultiplatformBleAdapter', :git => 'https://github.com/below/MultiPlatformBleAdapter', :tag => '0.1.9'

MultiPlatformBleAdapter needs to actually cut a release, it looks like it was only tagged at 0.1.9 and there's an ongoing thread. Then this repo needs updated here to use 0.1.9 and a release needs cut for FlutterBleLib.

toghi commented 2 years ago

Thanks.