尝试在颤动中单击按钮时增加振动,因此在Android上效果很好。但是在iOS中,它无法通过以下错误进行编译
GeneratedPluginRegistrant.m:6:9: fatal error: 'vibrate/VibratePlugin.h' file not found
我正在按照此处所述的确切步骤进行操作。
https://pub.dartlang.org/packages/vibrate#-installing-tab-
这是Xcode Build输出:
Launching lib/main.dart on ###'s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: #####
Running pod install...
Running Xcode build...
Xcode build done. 13.1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
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.
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.
/Users/####/Flutter_Projects/project_####l/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'vibrate/VibratePlugin.h' file not found
#import <vibrate/VibratePlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
无法为该设备生成预编译的应用程序。
答案 0 :(得分:0)
在构建适用于iOS的flutter应用程序时遇到了同样的问题,并找到了此链接为我解决了该问题。
https://github.com/benjamindean/flutter_vibration/issues/1
我相信答案是编辑您的... / appname / ios / Podfile
转到显示以下内容的部分:
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
并添加“ use_frameworks!”像这样在“目标“跑步者”处”下方
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods