找不到Flutter插件`geolocator-Swift.h`文件 [英] Flutter plugin `geolocator-Swift.h` file not found

查看:177
本文介绍了找不到Flutter插件`geolocator-Swift.h`文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个小的Flutter插件,该插件可用于监视Flutter应用程序中的位置更改(来源: https://github.com/baseflowit/flutter-geolocator ).在使用作为项目结构一部分(由Flutter CLI生成)的示例项目进行了广泛的测试之后,我们决定发布该插件以使其对全世界可用.

I have created a small Flutter plugin which can be used to monitor location changes in you Flutter application (source: https://github.com/baseflowit/flutter-geolocator). After extensive testing using the example project that is part of the project structure (as generated by the Flutter CLI) we decided to publish the plugin to make it available to the world.

现在,我们收到一些反馈,当您将在线Dart软件包存储库中的软件包包含到Flutter应用程序中时,iOS版本将无法编译并返回以下异常:

Now we received some feedback that when you include the package from the online Dart Packages repo into your Flutter App, the iOS version doesn't compile and returns the following exception:

/Users/maurits/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-0.0.2/ios/Classes/GeolocatorPlugin.m:2:9:
fatal error: 'geolocator/geolocator-Swift.h' file not found

在调试模式下运行Flutter App时,以及在使用flutter build ios --release制作iOS软件包时,都会发生此错误.

This error occurs when running the Flutter App in debug mode, but also when making a iOS package using flutter build ios --release.

这个错误的出处让我有些失落,因为作为Geolocator项目一部分的example应用程序可以正常工作.我知道geolocator/geolocator-Swift.h文件是自动生成的,因此对我来说,该文件似乎没有最终出现在Dart包中.要运行最终的Dart程序包,我运行了以下命令:

I am a bit lost where this error comes from since the example app that is part of the Geolocator project works without any problems. I know the geolocator/geolocator-Swift.h file is autogenerated, so to me it looks like that the file doesn't end up in the final Dart Package. To run the final Dart Package I ran the following command:

flutter packages pub publish

这是flutter doctor -v的输出:

[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-NL)
    • Flutter version 0.5.1 at /Users/maurits/Developer/flutter
    • Framework revision c7ea3ca377 (4 weeks ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.0)
    • Android SDK at /Users/maurits/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.0
    • ANDROID_HOME = /Users/maurits/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] VS Code (version 1.24.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected devices (1 available)
    • iPhone X • 69C349CF-81E1-47E8-B35A-A149D885CE43 • ios • iOS 11.4 (simulator)

任何帮助将不胜感激.

推荐答案

由于插件是使用Swift编写的,因此使用量较大的Flutter应用应基于Swift项目模板:

Since the plugin is written using Swift, the consuming Flutter app should be based on the Swift project template:

$ flutter create -i swift my_app

geolocator:添加到pubspec.yaml并为iOS构建my_app,然后使用最新的Flutter beta对我有用.

Adding geolocator: to the pubspec.yaml and building my_app for iOS then works for me using the latest Flutter beta.

[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-US)

这篇关于找不到Flutter插件`geolocator-Swift.h`文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆