DEV Community

Cover image for That One Share Button That Broke on iOS 26 and How I Fixed It
Alamin Karno
Alamin Karno

Posted on

That One Share Button That Broke on iOS 26 and How I Fixed It

A few weeks ago, during my holiday break, I decided to revisit one of my old pet projects WallpaperHub. It’s a simple Flutter app where users can browse wallpapers and share them with friends.

Nothing fancy.
Nothing experimental.

Or at least… that’s what I thought.


The Calm Before the Crash

The app had been running perfectly for a long time.

  • Flutter app ✅
  • share_plus plugin ✅
  • Tested on iOS 17 ✅
  • Tested on Android ✅

I recently updated my system and got access to an iOS 26 device.
Naturally, I wanted to run the app and see how it behaves on the latest iOS.

The app launched.
The UI looked fine.
Scrolling was smooth.

Then I tapped the Share button.

💥 Boom. Runtime exception.


“Wait… This Worked Yesterday”

The crash happened only when triggering the share action.

What confused me even more:

  • Same code
  • Same plugin version
  • Same app
  • Worked perfectly on iOS 17

But on iOS 26, the app crashed immediately.

At first, I assumed:

  • Maybe Xcode issue
  • Maybe simulator bug
  • Maybe iOS beta instability

But no, this was a real breaking change.


The Error That Gave It Away

After carefully reading the logs, the issue pointed toward the share sheet presentation on iOS.

That’s when I remembered something important:

On iOS, sharing content requires a valid source rectangle for popover presentation.

Older iOS versions were more forgiving.
iOS 26? Not anymore.


The Root Cause (Why This Happens)

If you’re using share_plus version 11 or below, the plugin internally relied on deprecated behavior when presenting the iOS share sheet.

Specifically:

  • iOS now strictly requires a valid sharePositionOrigin
  • Without it, the app crashes at runtime
  • Older iOS versions silently ignored this

So, upgrading iOS exposed an incompatibility in older plugin versions.

This wasn’t a Flutter issue.
This wasn’t my code logic issue.
It was an outdated dependency.


The Quick Fix (Two Ways)

Recommended Solution: Upgrade share_plus

The easiest and safest solution is:

dependencies:
  share_plus: ^latest
Enter fullscreen mode Exit fullscreen mode

The newer versions properly handle iOS share sheet requirements.


Still Using Deprecated Code? It Won’t Break (Yet)

Interestingly, even in the latest versions, deprecated APIs still work, as long as you explicitly provide the required positioning.

Here’s the updated code I used in my app:

final box = context.findRenderObject() as RenderBox?;

return SharePlus.instance.share(
  ShareParams(
    text: text,
    title: title,
    subject: subject,
    sharePositionOrigin:
        box!.localToGlobal(Offset.zero) & box.size, // REQUIRED for iOS
  ),
);
Enter fullscreen mode Exit fullscreen mode

This single line is the key

box!.localToGlobal(Offset.zero) & box.size
Enter fullscreen mode Exit fullscreen mode

It tells iOS:

“Here’s where the share sheet should originate from.”

Without it, 💥 crash.


Real Example From My Project

This wasn’t a demo fix.
This is exactly what I did in my real project WallpaperHub.

If you open that file, you’ll see how the helper method safely handles sharing across platforms including iOS 26.


Why iOS 26 Made This Visible

This is the important takeaway

iOS 26 didn’t break your app.
It stopped tolerating unsafe behavior.

Older iOS versions:

  • Allowed missing share origin
  • Failed silently

iOS 26:

  • Enforces correct popover positioning
  • Crashes if you don’t provide it

This is actually a good thing but only if your dependencies are up to date.


Lessons Learned (So You Don’t Suffer Like I Did)

  • Always test your Flutter apps on the latest iOS
  • Old plugins can break even if your code hasn’t changed
  • iOS is less forgiving with UI presentation rules
  • Reading logs carefully saves hours
  • Sometimes… AI really does help

Final Thoughts

This bug cost me a few hours of digging, log reading, and head scratching all from tapping a single Share button.

But that’s Flutter life:

  • One OS update
  • One outdated plugin
  • One runtime crash

Hopefully, this story saves you that time.

If your Flutter app crashes on iOS 26 when sharing, now you know exactly why and how to fix it.

Happy coding 🚀 And keep your dependencies fresh.

Top comments (0)