I got your plugin working once somehow but, now I can't get it to build, even with a new project.
Steps:
flutter create projectflutter pub getflutter_blue: ^0.6.2flutter build ios/usr/local/bin/bash: line 3: /Users/chris/dev/cognuro/Pods/!ProtoCompiler/protoc: No such file or directoryln -s ios/Pods Podsflutter build iosXcode's output:
↳
4 warnings generated.
/Users/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.m:545:49: warning: 'CBManagerState' is only available on iOS 10.0 or newer
[-Wunguarded-availability]
- (ProtosBluetoothState*)toBluetoothStateProto:(CBManagerState)state {
^
In module 'CoreBluetooth' imported from /Users/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.m:545:1: note: annotate 'toBluetoothStateProto:' with an availability attribute
to silence this warning
- (ProtosBluetoothState*)toBluetoothStateProto:(CBManagerState)state {
^
API_AVAILABLE(ios(10.0))
/Users/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.m:106:52: warning: values of type 'NSUInteger' should not be used as format
arguments; add an explicit cast to 'unsigned long' instead [-Wformat]
NSLog(@"getConnectedDevices periphs size: %d", [periphs count]);
~~ ^~~~~~~~~~~~~~~
%lu (unsigned long)
/Users/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/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/chris/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/Classes/FlutterBluePlugin.m:80:37: note: enclose 'CBManagerStatePoweredOn' in an @available check to
silence this warning
if(self.centralManager.state == CBManagerStatePoweredOn) {
^~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
Building AOT snapshot in release mode (ios-release)...
Building App.framework for arm64...
Building App.framework for armv7...
Building AOT snapshot in release mode (ios-release)... 14.3s
Built to build/aot/.
warning: parsing line table prologue at offset 0x6f697463 found unsupported version 0x00
warning: line table parameters mismatch. Cannot emit.
note: while processing /Users/chris/dev/cognuro/build/aot/armv7/snapshot_assembly.o
Project /Users/chris/dev/cognuro built and packaged successfully.
/Users/chris/dev/cognuro/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'flutter_blue/FlutterBluePlugin.h' file not found
#import <flutter_blue/FlutterBluePlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/chris/dev/cognuro/ios/Runner/GeneratedPluginRegistrant.m:6:9: note: did not find header 'FlutterBluePlugin.h' in framework 'flutter_blue' (loaded from
'/Users/chris/dev/cognuro/build/ios/Release-iphoneos/flutter_blue')
1 error generated.
error: the following command failed with exit code 1 but produced no further output
CompileC
/Users/chris/Library/Developer/Xcode/DerivedData/Runner-akubqslycmaxdqdmtwulxlsejbko/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/Objects-normal/arm64/GeneratedPlugi
nRegistrant.o /Users/chris/dev/cognuro/ios/Runner/GeneratedPluginRegistrant.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build systemnote: Planning buildnote: Constructing build description
If I do flutter clean the warning go away, but the error remains.
i have problem like you.
I have the same issue.
looks like the problem is with Protos subspec in cocoapods Podspec file
s.subspec 'Protos' do |ss|
ss.source_files = 'gen/**/*.pbobjc.{h,m}'
ss.header_mappings_dir = 'gen'
ss.requires_arc = false
ss.dependency 'Protobuf'
end
ss.header_mappings_dir = 'gen' line messes the visibility of the header files in the pods project.
I commented it out and compiled the project without the errors.
s.subspec 'Protos' do |ss|
ss.source_files = 'gen/**/*.pbobjc.{h,m}'
#ss.header_mappings_dir = 'gen'
ss.requires_arc = false
ss.dependency 'Protobuf'
end
Works for my project, but could introduce some unintended side effects though
Where do you find the file?
it's in the .pub-cache subfolder in the flutter main folder
in my case the path is ~/develop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.2/ios/flutter_blue.podspec
@vodovozovge thanks it now builds just fine. I just hope they fix this as soon as possible. :) Thx again for the help :)
This should be resolved in the latest version 0.6.3.
Please try it out and let me know if it works for you.
Thanks!
@pauldemarco No it's not working for me. I think the problem is still the subspec part, since you have included generated pb files in source control, why not just remove the entire subspec part?
@pauldemarco Hmmm.. after removing !ProtoCompiler it gives more errors that it cannot found protobuf built in types like Any etc. Actually 0.6.2 works perfectly for me by just commenting out the single line ss.header_mappings_dir = 'gen'
@hanabi1224
Try again after removing Podfile and Podfile.lock.
I have a working version with those changes in PR 405, but I’m hesitant to add protoc back in, since it seems the path resolving doesn’t work for everyone.
@pauldemarco the path thing was not configured properly before, I have fixed it in #403 , and have also verified the fix with CI build, please take a look
I believe there were some mistakes and some mitigations come together which makes the build flacky (maybe I can explain later), I don't think previous version can build successfully in a clean environment, and now with CI build passing it has no reason to not work for everyone.
Modifing the file still wont work for me. any updates?
@softmarshmallow If you made in place update of podspec in package cache with change 403 manually, try flutter clean then build
Try one of this two:
https://github.com/pauldemarco/flutter_blue/issues/406#issuecomment-544501458
https://github.com/pauldemarco/flutter_blue/issues/406#issuecomment-544530920
The only thing that worked for me was removing the iOS project, creating a new one and using Objective-C instead of Swift.
You have to create a bridging header in xcode, see my steps for the solution here:
https://github.com/fengqiangboy/flutter-nordic-dfu/issues/4#issuecomment-532506690
Open the project with XCode. Then choose File -> New -> File -> Swift File.
A dialog will be displayed when creating the swift file(Since this file is deleted, any name can be used.). XCode will ask you if you wish to create Bridging Header, click yes.
Make sure you have use_frameworks! in the Runner block, in ios/Podfile。
Make sure you have SWIFT_VERSION 4.2 selected in you XCode -> Build Settings
Do flutter clean
Go to your ios folder, delete Podfile.lock and Pods folder and then execute pod install --repo-update
@zwells The bridging header already exists in new swift flutter projects
Sorry, I'm using Flutter 1.5 in order to use an over-the-air updates library that depends on flutter_blue 0.5.0
Same issue here. New clean project
The changes by hanabi1224 in #403 fix the issue for me on an objective-c based project with latest flutter stable 1.9.1+hotfix5. I also created a bridging header and have use_frameworks enabled and SWIFT_VERSION set to 4.2 in my podspec.
It looks like the Flutter team has merged in a change to the plugin template to address some of these issues: https://github.com/flutter/flutter/pull/44324. Might be worth adding them to this repo.
I needed do downgrade to 0.6.1 and comment the line ss.header_mappings_dir = '.' in flutter_blue.pubspec. Worked to me.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
I can not run my project on iOS because of this same error. What is the cause? is there a workaround?
I needed do downgrade to
0.6.1and comment the liness.header_mappings_dir = '.'influtter_blue.pubspec. Worked to me.Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale pt-BR)[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
thanks! this is working for 0.6.3+1
I tried that. Worked to me too.
Hi,
I'm trying to build my iOS app using flutter_blue 0.7.2 and it still fails. Are there any plans to fix this issue ?
It works for me.
I have the same issue.
looks like the problem is withProtossubspec in cocoapods Podspec files.subspec 'Protos' do |ss| ss.source_files = 'gen/**/*.pbobjc.{h,m}' ss.header_mappings_dir = 'gen' ss.requires_arc = false ss.dependency 'Protobuf' end
ss.header_mappings_dir = 'gen'line messes the visibility of the header files in the pods project.I commented it out and compiled the project without the errors.
s.subspec 'Protos' do |ss| ss.source_files = 'gen/**/*.pbobjc.{h,m}' #ss.header_mappings_dir = 'gen' ss.requires_arc = false ss.dependency 'Protobuf' endWorks for my project, but could introduce some unintended side effects though
Thx, Also works for me!
I have the same issue.
looks like the problem is withProtossubspec in cocoapods Podspec files.subspec 'Protos' do |ss| ss.source_files = 'gen/**/*.pbobjc.{h,m}' ss.header_mappings_dir = 'gen' ss.requires_arc = false ss.dependency 'Protobuf' end
ss.header_mappings_dir = 'gen'line messes the visibility of the header files in the pods project.I commented it out and compiled the project without the errors.
s.subspec 'Protos' do |ss| ss.source_files = 'gen/**/*.pbobjc.{h,m}' #ss.header_mappings_dir = 'gen' ss.requires_arc = false ss.dependency 'Protobuf' endWorks for my project, but could introduce some unintended side effects though
works for me, commented this line in the file
~/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.7.2/ios/flutter_blue.podspec
then run pod install again
This is a solution that works but still doesn't solve the problem when using CI tools.
I'm facing the same issue. someone, please help me to solve this issue.
I'm facing the same issue. someone, please help me to solve this issue.
Updating cocoapods by 'sudo gem install cocoapods' & flutter pub upgrade fixed that issue for me
Hi @chrisdrobison , could you let know if this issue is still valid for you ?
Following below comment from @pauldemarco , I was able to get past the similar build error that you faced.
https://github.com/pauldemarco/flutter_blue/issues/406#issuecomment-545993733
Basically had to delete all the pods* files & directories, comment podspec line to use static lib(.a) instead of framework files and do a clean before building it again.
Help close the issue if you were able to build successfully. Thanks.
(flutter_blue version: 0.7.2)
I'm not developing the app any more that required this and I think the person that is when with another solution so I couldn't say if this is an issue still or not.
@hanabi1224
Try again after removing Podfile and Podfile.lock.
I have a working version with those changes in PR 405, but I’m hesitant to add protoc back in, since it seems the path resolving doesn’t work for everyone.
@pauldemarco , Can you please include this in ReadMe?
I have the same issue.
In 0.6.3 & 0.7.3
Users/builder/programs/flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3+1/ios/Classes/FlutterBluePlugin.m:106:53: warning: values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead [-Wformat]
NSLog(@"getConnectedDevices periphs size: %lu", [periphs count]);
~ ^~~~~
%lu (unsigned long)
For the benefit of everyone looking at this issue, in our project we’ve moved on. When we started this was the only BT plug-in available and now there are a few more well supported ones. I would look around at this point.
really, have any suggestions?
We've had success with this one: https://pub.dev/packages/flutter_ble_lib
I tried to use this package, but I was not successful following the
tutorial, do you have any projects that I can be inspired by?
Em ter, 6 de abr de 2021 17:53, Chris Robison @.*>
escreveu:
We've had success with this one: https://pub.dev/packages/flutter_ble_lib
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/pauldemarco/flutter_blue/issues/386#issuecomment-814433620,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGLKVU6LKWADYAMKMJ2VKH3THNYF7ANCNFSM4I67UN3A
.
Remove the sub podSpec, it works well.
s.dependency 'Flutter'
s.platform = :ios, '8.0'
s.framework = 'CoreBluetooth'
# Fix the subspec `Protos` could not referenced in mobile-connected
s.requires_arc = ['Classes/**/*.m']
s.dependency "Protobuf", '~> 3.12.0'
# s.subspec "Protos" do |ss|
# ss.source_files = "gen/*.pbobjc.{h,m}", "gen/**/*.pbobjc.{h,m}"
# ss.header_mappings_dir = "gen"
# ss.requires_arc = false
# ss.dependency "Protobuf", '~> 3.11.4'
# end
Most helpful comment
I have the same issue.
looks like the problem is with
Protossubspec in cocoapods Podspec filess.header_mappings_dir = 'gen'line messes the visibility of the header files in the pods project.I commented it out and compiled the project without the errors.
Works for my project, but could introduce some unintended side effects though