generating a build for iOS introduces an error in 'SwiftSpeechToTextPlugin' is only available on iOS 10.0 or later [-Wunguarded-Availability]
Closed this issue · 4 comments
following log is displayed
Building br.com.sankhya.biaAssistantFlutter for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: HV5V7KBQHK
Running pod install... 1,9s
Running Xcode build...
Xcode build done. 15,2s
Failed to build iOS app
Error output from Xcode build:
↳
2019-12-27 13:04:04.065 xcodebuild[21809:175441] DTDeviceKit: deviceType from 37ad1425578933ae32b2a67eadc4eaa8f8096cb8 was NULL
** BUILD FAILED **
Xcode's output:
↳
/Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:6:4: warning: 'SwiftSpeechToTextPlugin' is only available on iOS 10.0 or newer [-Wunguarded-availability]
[SwiftSpeechToTextPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:2:
/Users/ellenguissoni/Desktop/sankhya/bia-assistant-flutter/build/ios/Release-iphoneos/speech_to_text/speech_to_text.framework/Headers/speech_to_text-Swift.h:456:12: note: 'SwiftSpeechToTextPlugin' has been marked as being introduced in iOS 10.0 here, but the deployment target is iOS 8.0.0
@interface SwiftSpeechToTextPlugin : NSObject <FlutterPlugin>
^
/Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:6:4: note: enclose 'SwiftSpeechToTextPlugin' in an @available check to silence this warning
[SwiftSpeechToTextPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:6:4: warning: 'SwiftSpeechToTextPlugin' is only available on iOS 10.0 or newer [-Wunguarded-availability]
[SwiftSpeechToTextPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:2:
/Users/ellenguissoni/Desktop/sankhya/bia-assistant-flutter/build/ios/Release-iphoneos/speech_to_text/speech_to_text.framework/Headers/speech_to_text-Swift.h:211:12: note: 'SwiftSpeechToTextPlugin' has been marked as being introduced in iOS 10.0 here, but the deployment target is iOS 8.0.0
@interface SwiftSpeechToTextPlugin : NSObject <FlutterPlugin>
^
/Users/ellenguissoni/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-0.7.0/ios/Classes/SpeechToTextPlugin.m:6:4: note: enclose 'SwiftSpeechToTextPlugin' in an @available check to silence this warning
[SwiftSpeechToTextPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Building AOT snapshot in release mode (ios-release)...
Compiler message:
Error: SDK summary not found: ../../flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill.
Error: Error when reading '../../flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill': No such file or directory
Error: Error when reading '../../flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill': No such file or directory
Unhandled exception:
Crash when compiling package:bia_assistant_flutter/main.dart,
at character offset null:
Bad state: Empty input given.
#0 BinaryBuilder._checkEmptyInput (package:kernel/binary/ast_from_binary.dart:457:29)
#1 BinaryBuilder.readComponent.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:474:7)
#2 Timeline.timeSync (dart:developer/timeline.dart:163:22)
#3 BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:472:21)
#4 ProcessedOptions.loadComponent (package:front_end/src/base/processed_options.dart:410:10)
#5 ProcessedOptions.loadLinkDependencies.<anonymous closure> (package:front_end/src/base/processed_options.dart:394:35)
#6 MappedListIterable.elementAt (dart:_internal/iterable.dart:417:29)
#7 ListIterable.toList (dart:_internal/iterable.dart:221:19)
#8 ProcessedOptions.loadLinkDependencies (package:front_end/src/base/processed_options.dart:394:67)
<asynchronous suspension>
#9 generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:115:48)
<asynchronous suspension>
#10 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#11 generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:70:10)
#12 kernelForProgramInternal.<anonymous closure> (package:front_end/src/api_prototype/kernel_generator.dart:61:35)
#13 CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:135:20)
<asynchronous suspension>
#14 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#15 new Future.sync (dart:async/future.dart:224:31)
#16 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#17 _rootRun (dart:async/zone.dart:1126:13)
#18 _CustomZone.run (dart:async/zone.dart:1023:19)
#19 _runZoned (dart:async/zone.dart:1518:10)
#20 runZoned (dart:async/zone.dart:1465:12)
#21 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#22 CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#23 kernelForProgramInternal (package:front_end/src/api_prototype/kernel_generator.dart:60:32)
#24 kernelForProgram (package:front_end/src/api_prototype/kernel_generator.dart:52:17)
#25 compileToKernel (package:vm/kernel_front_end.dart:320:41)
#26 FrontendCompiler.compile.<anonymous closure> (package:frontend_server/frontend_server.dart:446:54)
#27 new Future.<anonymous closure> (dart:async/future.dart:176:37)
#28 _rootRun (dart:async/zone.dart:1122:38)
#29 _CustomZone.run (dart:async/zone.dart:1023:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#35 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
#36 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
#37 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
#38 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
#0 BinaryBuilder._checkEmptyInput (package:kernel/binary/ast_from_binary.dart:457:29)
#1 BinaryBuilder.readComponent.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:474:7)
#2 Timeline.timeSync (dart:developer/timeline.dart:163:22)
#3 BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:472:21)
#4 ProcessedOptions.loadComponent (package:front_end/src/base/processed_options.dart:410:10)
#5 ProcessedOptions.loadLinkDependencies.<anonymous closure> (package:front_end/src/base/processed_options.dart:394:35)
#6 MappedListIterable.elementAt (dart:_internal/iterable.dart:417:29)
#7 ListIterable.toList (dart:_internal/iterable.dart:221:19)
#8 ProcessedOptions.loadLinkDependencies (package:front_end/src/base/processed_options.dart:394:67)
<asynchronous suspension>
#9 generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:115:48)
<asynchronous suspension>
#10 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#11 generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:70:10)
#12 kernelForProgramInternal.<anonymous closure> (package:front_end/src/api_prototype/kernel_generator.dart:61:35)
#13 CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:135:20)
<asynchronous suspension>
#14 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#15 new Future.sync (dart:async/future.dart:224:31)
#16 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#17 _rootRun (dart:async/zone.dart:1126:13)
#18 _CustomZone.run (dart:async/zone.dart:1023:19)
#19 _runZoned (dart:async/zone.dart:1518:10)
#20 runZoned (dart:async/zone.dart:1465:12)
#21 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#22 CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#23 kernelForProgramInternal (package:front_end/src/api_prototype/kernel_generator.dart:60:32)
#24 kernelForProgram (package:front_end/src/api_prototype/kernel_generator.dart:52:17)
#25 compileToKernel (package:vm/kernel_front_end.dart:320:41)
#26 FrontendCompiler.compile.<anonymous closure> (package:frontend_server/frontend_server.dart:446:54)
#27 new Future.<anonymous closure> (dart:async/future.dart:176:37)
#28 _rootRun (dart:async/zone.dart:1122:38)
#29 _CustomZone.run (dart:async/zone.dart:1023:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#35 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
#36 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
#37 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
#38 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
Compiler terminated unexpectedly.
Failed to build /Users/ellenguissoni/Desktop/sankhya/bia-assistant-flutter.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Encountered error while building for device.
Process finished with exit code 1
I can only generate a build when I clear the cache
It looks like the flutter installation cache folder is broken.
rm -rf / Users/macuser/Programs/flutter/bin/cache
The build works when you clear the cache? If so that's odd unless you changed the app in the meantime. Looks like you're trying to build your own application that depends on SpeechToText, not the included example? It is true that the SpeechToText plugin only supports iOS 10 or later.
Looks like I should add the guard conditions so that I don't block other applications that want to support lower versions. I'll look at those changes. Thanks for the report.
So I had a look, it is possible to make it support lower versions but it makes the code significantly less readable and given that I can't even get a simulator below iOS 10 anymore I don't think there's a market for it. I think that it is probably better for the plugin to leave it at iOS 10 and require any applications that use it to set their minimum iOS version to 10 or above. Please let me know if that causes problems.
If you're curious there's a version of the plugin code in the iOS-8 branch of the repo. Feel free to try it out if you'd like. Because it doesn't have the @available 10 check around the plugin it won't throw the unguarded availability check at compile time. However I haven't been able to test it on an old OS. If there's sufficient demand I'll look at adding it to master.
The latest commit changes the Podfile for the example to declare iOS 10 which removes the unguarded warning. I'm going to close this until I get more feedback on a need for support below iOS 10.
platform :ios, '10.0'