英文:
Flutter "share_plus" sharePositionOrigin PlatformException on iOS
问题
我正在使用"share_plus" Flutter库来通过Firebase动态链接分享文件。以下是我目前正在使用的代码:
在Android上,分享底部表单正常打开。但是,在iOS上,分享底部表单不会打开,并且日志显示以下错误消息:
[VERBOSE-2:dart_vm_initializer.cc(41)] 未处理的异常:PlatformException(错误,sharePositionOrigin:参数必须设置,{{0,0},{0,0}}必须为非零且位于源视图的坐标空间内:{{0,0},{414,736}},null,null)
#0 StandardMethodCodec.decodeEnvelope(package:flutter/src/services/message_codecs.dart:653)
#1 MethodChannel._invokeMethod(package:flutter/src/services/platform_channel.dart:315)
#2 MethodChannelShare.shareFilesWithResult(package:share_plus_platform_interface/method_channel/method_channel_share.dart:134)
任何帮助将不胜感激!
英文:
I am using the "share_plus" Flutter library to share a file with a Firebase dynamic link. Here is the code I am currently using:
...............
final dynamicLink =
await FirebaseDynamicLinks.instance.buildShortLink(dynamicLinkParams);
var description = 'Check this out on our app ${dynamicLink.shortUrl}';
Share.shareXFiles([XFile(fileName)], text: description).then((value) async {
setState(() {
shareCount += 1;
});
SharedPreferences preferences = await SharedPreferences.getInstance();
preferences.remove("sharedPostId");
Navigator.pop(context);
});
.................
On Android, the share bottom sheet opens fine. However, on iOS, the share bottom sheet does not open, and the logs display the following error message:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, sharePositionOrigin: argument must be set, {{0, 0}, {0, 0}} must be non-zero and within coordinate space of source view: {{0, 0}, {414, 736}}, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:315)
<asynchronous suspension>
#2 MethodChannelShare.shareFilesWithResult (package:share_plus_platform_interface/method_channel/method_channel_share.dart:134)
Any help will be greatly appreciated!
答案1
得分: 1
请查看 pub.dev 上的 iPad 使用说明:参数 sharePositionOrigin
是必需的。
英文:
See the instructions for iPad on pub.dev : the parameter sharePositionOrigin
is required.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论