【发布时间】:2020-10-25 03:28:01
【问题描述】:
在 Android 上运行良好,但当我在 iOS 上运行时。它显示了一些警告,但也显示了一个错误。以下是日志。
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
(This is taking an unexpectedly long time.)⡿
Compiler message:
../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:279:8: Error: The
method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
void install(OverlayEntry insertionPoint) {
^
../../../../desktop/dev/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').
void install() {
^
(This is taking an unexpectedly long time.)⡿../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/routes/default_route.dart:242:9: Error: No named
parameter with the name 'animation'.
animation: animation,
^^^^^^^^^
../../../../desktop/dev/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments
don't match.
CupertinoFullscreenDialogTransition({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(This is taking an unexpectedly long time.)⣟../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:289:18: Error: Too
many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
super.install(insertionPoint);
^
Running pod install... 11.5s
Running Xcode build...
Xcode build done. 63.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/apple/desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.m:88:37:
warning: incompatible pointer types sending 'FlutterEngine *' to parameter of type 'NSObject<FlutterBinaryMessenger> * _Nonnull'
[-Wincompatible-pointer-types]
binaryMessenger:_headlessEngine];
^~~~~~~~~~~~~~~
In module 'Flutter' imported from
/Users/apple/desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.h:2:
/Users/apple/Desktop/dev/upwork/body_alarm/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h:178:74: note: passing argument
to parameter 'messenger' here
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
^
1 warning generated.
/Users/apple/desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.m:6:4: warning:
'SwiftVibrationPlugin' is only available on iOS 13.0 or newer [-Wunguarded-availability-new]
[SwiftVibrationPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~
In file included from
/Users/apple/desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.m:2:
/Users/apple/Desktop/dev/upwork/body_alarm/build/ios/Debug-iphonesimulator/vibration/vibration.framework/Headers/vibration-Swift.h
:213:12: note: 'SwiftVibrationPlugin' has been marked as being introduced in iOS 13.0 here, but the deployment target is iOS 8.0.0
@interface SwiftVibrationPlugin : NSObject <FlutterPlugin>
^
/Users/apple/desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.m:6:4: note:
enclose 'SwiftVibrationPlugin' in an @available check to silence this warning
[SwiftVibrationPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~
1 warning generated.
Compiler message:
../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:279:8: Error: The
method 'SnackRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
void install(OverlayEntry insertionPoint) {
^
../../../../desktop/dev/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method
('install').
void install() {
^
../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/routes/default_route.dart:242:9: Error: No
named parameter with the name 'animation'.
animation: animation,
^^^^^^^^^
../../../../desktop/dev/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the
arguments don't match.
CupertinoFullscreenDialogTransition({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../desktop/dev/flutter/.pub-cache/hosted/pub.dartlang.org/get-1.17.3/lib/src/snackbar/snack_route.dart:289:18: Error: Too
many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
super.install(insertionPoint);
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
这些是我在这个应用程序中使用的包:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
json_annotation:
audioplayers: ^0.15.1
wakelock:
shared_preferences:
vibration: ^1.4.0
flutter_local_notifications: ^1.1.5+1
flutter_icons: ^1.0.0+1
flutter_launcher_icons: ^0.7.4
url_launcher: ^5.4.2
get: ^1.15.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
build_runner:
json_serializable:
flutter_test:
sdk: flutter
我也尝试创建一个新项目并将之前项目中的所有代码复制到新项目中,但仍然无法正常工作。谁能帮我解决这些问题。
【问题讨论】:
-
你能发布
flutter --version的输出吗?
标签: ios xcode flutter flutter-dependencies