EDIT 4/3/2020: This issue has been resolved.
When trying to run my Flutter app on iOS, I'm getting a build error.
The error states that the header file FlutterBluePlugin.h can't be found. And it indeed doesn't exist under the directory where it should. FYI I ran flutter pub get before building. Reproduced the issue with a clean project that just has the plugin dependency in its pubspec.yaml .
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 2,0s
Running Xcode build...
āāAssembling Flutter resources... 16,9s
āāCompiling, linking and signing... 1,9s
Xcode build done. 24,3s
Failed to build iOS app
Error output from Xcode build:
ā³
** BUILD FAILED **
Xcode's output:
ā³
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:546:49: warning: 'CBManagerState' is only available on iOS 10.0 or newer [-Wunguarded-availability]
- (ProtosBluetoothState*)toBluetoothStateProto:(CBManagerState)state {
^
In module 'CoreBluetooth' imported from
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.h
:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Fr
ameworks/CoreBluetooth.framework/Headers/CBManager.h:32:28: note: 'CBManagerState' has been marked as being introduced in iOS 10.0
here, but the deployment target is iOS 8.0.0
typedef NS_ENUM(NSInteger, CBManagerState) {
^
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:546:1: note: annotate 'toBluetoothStateProto:' with an availability attribute to silence this warning
- (ProtosBluetoothState*)toBluetoothStateProto:(CBManagerState)state {
^
API_AVAILABLE(ios(10.0))
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:74:37: warning: 'CBManagerStateUnsupported' is only available on iOS 10.0 or newer [-Wunguarded-availability]
if(self.centralManager.state != CBManagerStateUnsupported && self.centralManager.state != CBManagerStateUnknown) {
^~~~~~~~~~~~~~~~~~~~~~~~~
In module 'CoreBluetooth' imported from
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.h
:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Fr
ameworks/CoreBluetooth.framework/Headers/CBManager.h:32:28: note: 'CBManagerState' has been marked as being introduced in iOS 10.0
here, but the deployment target is iOS 8.0.0
typedef NS_ENUM(NSInteger, CBManagerState) {
^
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:74:37: note: enclose 'CBManagerStateUnsupported' in an @available check to silence this warning
if(self.centralManager.state != CBManagerStateUnsupported && self.centralManager.state != CBManagerStateUnknown) {
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:74:95: warning: 'CBManagerStateUnknown' is only available on iOS 10.0 or newer [-Wunguarded-availability]
if(self.centralManager.state != CBManagerStateUnsupported && self.centralManager.state != CBManagerStateUnknown) {
^~~~~~~~~~~~~~~~~~~~~
In module 'CoreBluetooth' imported from
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.h
:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Fr
ameworks/CoreBluetooth.framework/Headers/CBManager.h:32:28: note: 'CBManagerState' has been marked as being introduced in iOS 10.0
here, but the deployment target is iOS 8.0.0
typedef NS_ENUM(NSInteger, CBManagerState) {
^
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:74:95: note: enclose 'CBManagerStateUnknown' in an @available check to silence this warning
if(self.centralManager.state != CBManagerStateUnsupported && self.centralManager.state != CBManagerStateUnknown) {
^~~~~~~~~~~~~~~~~~~~~
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:80:37: warning: 'CBManagerStatePoweredOn' is only available on iOS 10.0 or newer [-Wunguarded-availability]
if(self.centralManager.state == CBManagerStatePoweredOn) {
^~~~~~~~~~~~~~~~~~~~~~~
In module 'CoreBluetooth' imported from
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.h
:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Fr
ameworks/CoreBluetooth.framework/Headers/CBManager.h:32:28: note: 'CBManagerState' has been marked as being introduced in iOS 10.0
here, but the deployment target is iOS 8.0.0
typedef NS_ENUM(NSInteger, CBManagerState) {
^
/Users/navaronbracke/Documents/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m
:80:37: note: enclose 'CBManagerStatePoweredOn' in an @available check to silence this warning
if(self.centralManager.state == CBManagerStatePoweredOn) {
^~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
While building module 'flutter_blue' imported from
/Users/navaronbracke/Documents/WeForza/weforza/weforza/ios/Runner/GeneratedPluginRegistrant.m:22:
In file included from <module-includes>:1:
/Users/navaronbracke/Documents/WeForza/weforza/weforza/build/ios/Debug-iphonesimulator/flutter_blue/flutter_blue.framework/Headers/flu
tter_blue-umbrella.h:13:9: fatal error: 'FlutterBluePlugin.h' file not found
#import "FlutterBluePlugin.h"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/navaronbracke/Documents/WeForza/weforza/weforza/ios/Runner/GeneratedPluginRegistrant.m:22:9: fatal error: could not build
module 'flutter_blue'
@import flutter_blue;
~~~~~~~^~~~~~~~~~~~
2 errors generated.
note: Using new build system
note: Planning build
note: Constructing build description
warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test
your code with āUse of deprecated Swift 3 @objc inferenceā logging enabled, and then disable inference by changing the "Swift 3 @objc
Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
The Swift 3 deprecation issue is probably for another ticket.
I'd suggest bumping the minimum supported version to iOS 10. No clue why it sits at the unsupported version 8 though.
Your error does not stem from the fact that the BLE APIs aren't available in iOS 8 (it's only warnings), but from the fact you are probably using "use_frameworks!" in your Podfile to accommodate for Swift plugins. The latter usually breaks header mappings defined in podspecs, to fix it comment this line in flutter_blue's podspec:
ss.header_mappings_dir = '.' (line 24)
Your suggestion fixed it, thanks a lot. Closing the issue.
Your error does not stem from the fact that the BLE APIs aren't available in iOS 8 (it's only warnings), but from the fact you are probably using "use_frameworks!" in your Podfile to accommodate for Swift plugins. The latter usually breaks header mappings defined in podspecs, to fix it comment this line in flutter_blue's podspec:
ss.header_mappings_dir = '.'(line 24)
This didn't fix the problem for me. Instead, i removed use_frameworks! from the Podspec.
header mappings defined in podspecs
this fix the error its not sending and error using use_frameworks! in podspec but the app closes on app init did you know why?
header mappings defined in podspecs
this fix the error its not sending and error using use_frameworks! in podspec but the app closes on app init did you know why?
Most likely missing permissions, see the warning on Apple's developer documentation https://developer.apple.com/documentation/corebluetooth?language=objc
Your suggestion fixed it, thanks a lot. Closing the issue.
Hello, I met the same problem with you.
I comment this line 'ss.header_mappings_dir = ".' in flutter_blueāsā podspec file according to the above steps, but I got an error after I executed the flutter run, "could not build module flutter_blue"
Thank you for any Suggestions
Most helpful comment
Your error does not stem from the fact that the BLE APIs aren't available in iOS 8 (it's only warnings), but from the fact you are probably using "use_frameworks!" in your Podfile to accommodate for Swift plugins. The latter usually breaks header mappings defined in podspecs, to fix it comment this line in flutter_blue's podspec:
ss.header_mappings_dir = '.'(line 24)