[Bug]: iOS 26 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, 896}}, null, null)
Platform
iPhone 11 - iOS 26 beta
Plugin
share_plus
Version
11.1.0
Flutter SDK
3.33.0-1.0.pre-1359
Steps to reproduce
final params = ShareParams(uri: Uri.parse("https://www.google.com")); SharePlus.instance.share(params);
it returns:
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] 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, 896}}, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:367:18)
Code Sample
final params = ShareParams(uri: Uri.parse("https://www.google.com/"));
SharePlus.instance.share(params);
Logs
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] 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, 896}}, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:367:18)
<asynchronous suspension>
#2 MethodChannelShare.share (package:share_plus_platform_interface/method_channel/method_channel_share.dart:25:20)
<asynchronous suspension>
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.33.0-1.0.pre-1359, on macOS 26.0 25A5327h darwin-arm64, locale en-SY)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.0)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources
Checklist before submitting a bug
- [x] I searched issues in this repository and couldn't find such bug/problem
- [x] I Google'd a solution and I couldn't find it
- [x] I searched on StackOverflow for a solution and I couldn't find it
- [x] I read the README.md file of the plugin
- [x] I'm using the latest version of the plugin
- [x] All dependencies are up to date with
flutter pub upgrade - [x] I did a
flutter clean - [x] I tried running the example project
I’m experiencing the same issue, but only when building with Xcode 26. When I build with Xcode 16, everything works fine. Flutter 3.32.5
Has anyone been able to fix this problem, it's happening to me too
It worked like this.
final box = context.findRenderObject() as RenderBox?;
await SharePlus.instance.share(ShareParams(
uri: _uri,
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size));
It looks like it reproduces on real devices only as I can't reproduce the issue on simulators with iOS 26. Will update the documentation and release it as update.
It worked like this.
final box = context.findRenderObject() as RenderBox?; await SharePlus.instance.share(ShareParams( uri: _uri, sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size));
Not sure how is that going to help on iPhones, the parameter is ignored on iPhones as per the documentation:
The optional sharePositionOrigin parameter can be used to specify a global origin rect for the share sheet to popover from on iPads and Macs. It has no effect on other devices.
We are receiving the same error on iPhone 14Pro, even though we have already used the parameter, check the logs at the end:
final box = mounted ? context.findRenderObject() as RenderBox? : null;
await SharePlus.instance.share(
ShareParams(
files: [XFile(success.exportFile!)],
sharePositionOrigin: box != null
? (box.localToGlobal(Offset.zero) & box.size)
: null,
),
);
Logs:
PlatformException(error, sharePositionOrigin: argument must be set,
{{103.15129949999999, 223.62571800000001}, {393, 852}} must be non-zero and within coordinate space of source view: {{0, 0}, {393, 852}}, null, null)
0 ??? 0x0 StandardMethodCodec.decodeEnvelope + 652 (message_codecs.dart:652)
1 ??? 0x0 MethodChannel._invokeMethod + 370 (platform_channel.dart:370)
2 ??? 0x0 MethodChannelShare.share + 25 (method_channel_share.dart:25)
3 ??? 0x0 _ExportWidgetState._exportAppData.<fn> + 115 (export_widget.dart:115)
4 ??? 0x0 _ExportWidgetState._exportAppData + 108 (export_widget.dart:108)
Same here, it's crashing under iOS 26.
SharePlus.instance.share(ShareParams(text: _messageShare));
Error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] 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}, {440, 956}}, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:367:18)
<asynchronous suspension>
#2 MethodChannelShare.share (package:share_plus_platform_interface/method_channel/method_channel_share.dart:25:20)
<asynchronous suspension>
TESTED:
Testing and using the previous version share_plus ^11.1.0 under iOS 26, sharing crashes.
Using:
SharePlus.instance.share(
ShareParams(
text: _messageShare,
),
);
But adding the trick stated in the GitHub ticket:
SharePlus.instance.share(
ShareParams(
text: _messageShare,
sharePositionOrigin: Rect.fromLTWH(0, 0, 1, 1),
),
);
This works in both ^11.1.0 and ^12.0.0.
But, if you do not use the sharePositionOrigin trick, it crashes with both versions under iOS 26.
@vbuberen can you clarify if, from now on, we need to specify the sharePositionOrigin? I have several apps that I need to release, and I want to ensure I am using the correct properties.
Thanks.
This works in both ^11.1.0 and ^12.0.0 Yes! Thanks this works for iOS 26
@vbuberen can you clarify if, from now on, we need to specify the sharePositionOrigin? I have several apps that I need to release, and I want to ensure I am using the correct properties.
Yes, after some testing from my side I can confirm that from now on we need to add sharePositionOrigin parameter as well.
I will release a small documentation update shortly to mention this fact.
Thanks to everyone, who reported and confirmed that sharePositionOrigin works. Will close once merge the PR with documentation updates.
Thank you for the clarification. I appreciate it.
Hi @vbuberen, thanks for the update.
Since this parameter is now mandatory, shouldn't we make the sharePositionOrigin required or provide a default value to avoid people from forgetting?
Hey @snipd-mikel Thanks for your suggestion, but this ticket isn't closed yet, since I haven't released anything related to this issue. I didn't want to rush as I feel like there is something strange with this requirement and want to investigate it a bit. But I am travelling this week, so I had no time to look properly. Next week is the one where I would either find out something else and share here more news here or, if my investigation finds nothing, I will just release a documentation update and indeed will mark the parameter in question as required and release a major version release to not break builds for plugin users.
I’m experiencing the same issue, but only when building with Xcode 26. When I build with Xcode 16, everything works fine. Flutter 3.32.5
Same with flutter 3.35.5
~~Hello! I see some suggested fixes here, but none worked for me on the latest iOS. I have tried both 11.1.0 and 12.0.0 versions of the package.~~ Please ignore this, my mistake.
Hello! I see some suggested fixes here, but none worked for me on the latest iOS. I have tried both 11.1.0 and 12.0.0 versions of the package.
This one worked for me with Flutter 3.35.5 and XCode 26:
sharePositionOrigin: Rect.fromLTWH(0, 0, 1, 1),
It took me a bit longer than I initially planned to investigate the issue properly, but I am glad to announce that the issue is finally resolved and can be closed.
In today's release 12.0.1 of share_plus parameter sharePositionOrigin is not required again on iPhones. The issue happened, because when the app was built with Xcode 26 there are API changes that made one of params that we use to detect whenever the device is an iPad or not, return the same value on iPhones. It made the plugin assume that the app runs on an iPad, thus, requiring sharePositionOrigin parameter and throwing exception to indicate that. I fixed this issue by improving the device type check, so in 12.0.1 share_plus works as before - without need to specify the sharePositionOrigin no matter in which Xcode you build your app.
With that being said I strongly advise everyone to get 12.0.1 of the plugin to avoid crashes.
P.S. I recommend to still have sharePositionOrigin in place to make your app iPad ready, even if you don't plan to support iPad for now. It a small thing, but ensures compatibility with more devices from early on.
@JediPixels Sorry for the ping, but since you were asking explicitly here earlier I would like to bring your attention that my previous answer is not valid anymore.
@vbuberen Thank you, I appreciate it.
In my case sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size) was not working so I tried with the below code and it worked for me.
sharePositionOrigin: Rect.fromLTWH(
0,
0,
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height / 2)```
Rect.fromLTWH( 0, 0, MediaQuery.of(context).size.width, MediaQuery.of(context).size.height / 2)
This work for me as well. When I use sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size), this works only later versions of ipad. But Rect from works in ios16 as well