#ios #flutter
#iOS #flutter
Вопрос:
Я обновился до FLutter 2.0.1, и теперь я не могу запустить свое приложение. Это ошибка, которая у меня есть:
Xcode build done. 34.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/ran/Development/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.m:367:23: warning: 'mediaPlaybackRequiresUserAction' is deprecated: first deprecated in iOS 9.0 [-Wdeprecated-declarations]
configuration.mediaPlaybackRequiresUserAction = true;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from /Users/ran/Development/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:211:28: note: 'mediaPlaybackRequiresUserAction' has been explicitly marked deprecated here
@property (nonatomic) BOOL mediaPlaybackRequiresUserAction API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(8.0, 9.0));
^
/Users/ran/Development/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.m:374:23: warning: 'mediaPlaybackRequiresUserAction' is deprecated: first deprecated in iOS 9.0 [-Wdeprecated-declarations]
configuration.mediaPlaybackRequiresUserAction = false;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from /Users/ran/Development/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h:211:28: note: 'mediaPlaybackRequiresUserAction' has been explicitly marked deprecated here
@property (nonatomic) BOOL mediaPlaybackRequiresUserAction API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(8.0, 9.0));
^
2 warnings generated.
../../../Development/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.1/lib/src/picture_provider.dart:52:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
../../../Development/Flutter/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
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
warning: Capabilities for Signing amp; Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2020.2.1)
[✓] VS Code (version 1.53.1)
[✓] Connected device (2 available)
И это мой запуск flutter — подробный
[ 103 ms] Could not build the application for the simulator.
[ 3 ms] Error launching application on iPhone 12 Pro Max.
[ 3 ms] "flutter run" took 39,841ms.
[ 4 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:644:9)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1009:27)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#5 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#6 CommandRunner.runCommand (package:args/command_runner.dart:197:13)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
<asynchronous suspension>
#8 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
<asynchronous suspension>
#11 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#12 run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#15 runInContext (package:flutter_tools/src/context_runner.dart:73:10)
<asynchronous suspension>
#16 main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>
Я пробовал некоторые онлайн-решения, такие как flutter clean и flutter run, но это не работает.
Можете ли вы помочь мне решить эту проблему? Спасибо вам, и я действительно ценю это.
Комментарии:
1.
Capabilities for Signing amp; Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor.
откройте ios Runner.xcworkapce. и проверьтеSigning amp; Capabilities
2. Спасибо вам за ваш ответ. Я решил проблему, заменив mediaPlaybackRequiresUserAction на mediaTypesRequiringUserActionForPlayback в файлах.
3. @Ran У меня такая же проблема, но нигде не объявлено mediaTypesRequiringUserActionForPlayback. Есть ли что-нибудь еще, что нужно проверить, чтобы решить проблему?
4. @AlexKost Я думаю, что он находится в папке Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView. Или вы можете попробовать понизить версию flutter. Это сработало бы
Ответ №1:
Проблема была вызвана webview_flutter
плагином, использующим устаревшую функцию в iOS 9. Более подробная информация обсуждается в этом выпуске. Эта проблема должна быть исправлена в последней версии плагина.