Flutter “share_plus” 在 iOS 上出现 PlatformException 的问题。

huangapple go评论66阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月2日 12:59:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387244.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定