我创建了一个小的Flutter插件,可以用来监视Flutter应用程序中的位置变化(来源:https://github.com/baseflowit/flutter-geolocator).在使用作为项目结构一部分的示例项目(由Flutter CLI生成)进行大量测试之后,我们决定发布该插件以使其可供全世界使用.
现在我们收到一些反馈,当您将在线Dart Packages repo中的软件包包含到Flutter App中时,iOS版本不会编译并返回以下异常:
/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
Run Code Online (Sandbox Code Playgroud)
在调试模式下运行Flutter App时会发生此错误,但在使用iOS包时也会发生此错误flutter build ios --release.
我有点迷失这个错误的地方,因为example作为Geolocator项目一部分的应用程序没有任何问题.我知道该geolocator/geolocator-Swift.h文件是自动生成的,所以对我而言,文件似乎不会在最终的Dart包中结束.要运行最终的Dart包,我运行以下命令:
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 …Run Code Online (Sandbox Code Playgroud) 我正在 Docker 容器中使用 Http 触发的 Azure 函数。到目前为止,我在设置此设置时找到的所有教程和指南都将 Azure 函数配置authLevel"为anonymous.
仔细阅读此博客后,似乎也可以(虽然棘手)配置其他身份验证级别。不幸的是,承诺的后续博客文章尚未(尚未)编写。
谁能帮我澄清一下我将如何进行设置?
我已经在我的MacBook Pro上配置了VSTS代理,当我手动运行它(使用./run.sh)时,它可以正常工作.
但是,当我将VSTS代理配置为作为服务运行(使用./svc.sh install和./svc.sh start)并在VSTS中对新构建进行排队时,我收到错误(在签名步骤中)"ANDROID_HOME未设置".
我在.bash_profile中配置了以下内容:
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Run Code Online (Sandbox Code Playgroud)
路径正确并且还运行echo $ANDROID_HOME返回预期值(在本例中/Users/mvanbeusekom/Library/Android/sdk).
有人知道什么可能是错的吗?
macos android azure-devops azure-pipelines-build-task azure-pipelines
我正在尝试为专有的 Android 库生成 Xamarin 绑定(换句话说,不幸的是我无法在此处共享此库)。但是我遇到了多态性问题。情况是这样的。
该库公开了 3 个接口Location,MobilityProfile并且Trip都扩展了该接口Reading。
该库还有一个接口Measurement,其中包含Reading getReading();应始终返回上述 3 个接口(Location、MobilityProfile或Trip)之一的方法。
我生成了绑定并编译了运行良好的绑定项目。下一步是在我的 Xamarin 项目中使用 Xamarin.Android 绑定,如下所示:
public void ProcessReading(IReading reading)
{
if (reading == null)
return null;
switch (reading)
{
case ILocation location:
// Process location
break;
case IMobilityProfile mobilityProfile:
// Process mobility profile
break;
case ITrip trip:
// Process trip
break;
default:
throw new NotSupportedException($"Processing the type '{reading.GetType().FullName}' is not …Run Code Online (Sandbox Code Playgroud) 当前,我们有一个返回Future<Stream<Position>>just 的方法,因为在内部,我们必须等待返回a的方法的结果,Future然后才能调用另一个返回Stream<Position>实际感兴趣的方法的代码。以下是代码:
Future<Stream<Position>> getPositionStream(
[LocationOptions locationOptions = const LocationOptions()]) async {
PermissionStatus permission = await _getLocationPermission();
if (permission == PermissionStatus.granted) {
if (_onPositionChanged == null) {
_onPositionChanged = _eventChannel
.receiveBroadcastStream(
Codec.encodeLocationOptions(locationOptions))
.map<Position>(
(element) => Position._fromMap(element.cast<String, double>()));
}
return _onPositionChanged;
} else {
_handleInvalidPermissions(permission);
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
因此,这里发生的是:
_getLocationPermission()方法,以便我们可以测试用户是否授予我们访问其设备(Android或iOS)上的位置服务的权限;Stream<Position>该值将在设备每次注册位置更改时更新。我有一种感觉,我们也可以不用等待就返回一个Future。类似于以下内容:
Stream<Position>该类的实例;_eventChannel.receiveBroadcastStream在then()方法Future<PermissionStatus>返回的方法中调用的逻辑_getLocationPermission()(因此我们不必等待它);_eventChannel.receiveBroadcastStream上发送的事件从中复制到先前创建(并返回)的流上。某种程度上这似乎是可能的,但在管理流时还包括一些开销,并确保在插件的实时周期中或当用户取消订阅时将事件传递给事件_eventChannel …
android ×1
async-await ×1
asynchronous ×1
azure-devops ×1
binding ×1
c# ×1
dart ×1
docker ×1
flutter ×1
ios ×1
macos ×1
stream ×1