fix(share_plus): avoid iOS 26 share sheet crash for non-image files#3813
fix(share_plus): avoid iOS 26 share sheet crash for non-image files#3813MohamedAbdallah-14 wants to merge 1 commit into
Conversation
Fixes fluttercommunity#3784. Pre-iOS 26 the plugin set LPLinkMetadata.originalURL to a fake file URL built from a display string (e.g. "DOCX • 500 KB") so the share sheet would show the file size/extension as a subtitle. iOS 26 tightened validation of originalURL: when SHSheetActivityItemsManager tries to fetch link metadata for the bogus URL — reproducible when sharing .docx files — it crashes with NSArrayM insertObject:atIndex: object cannot be nil. Gate the fake-URL trick on iOS < 26. On iOS 26 and later, leave originalURL unset; the share sheet works without the size subtitle but no longer crashes.
947441a to
77a5258
Compare
|
The Android API 36 job timed out waiting for the emulator to boot (Timeout waiting for emulator to boot at the getprop sys.boot_completed polling step) — it never reached the test phase. Fail-fast then cancelled API 32, API 29, and the iOS job before they could run. This PR is iOS-only (FPPSharePlusPlugin.m); no Android code is touched. Could you re-run the failed jobs when you get a chance? The iOS integration test in particular needs to actually execute to validate the fix. |
|
Friendly bump. The only red CI is the API 36 Android emulator boot timeout ( |
Fixes #3784.
What's wrong
Pre-iOS 26 the plugin used a fake file URL trick to display the file size and extension as a subtitle in the iOS share sheet:
This worked because pre-iOS 26 versions of
LinkPresentationaccepted anyNSURLand only used it for display lookup.iOS 26 tightened validation of
LPLinkMetadata.originalURL. WhenSHSheetActivityItemsManagerasynchronously fetches link metadata for the bogus URL — reproducible when sharing.docxfiles —LPLinkPreviewreturns anilor incomplete metadata object, and_updateMetadataItemForActivityItem:withFetchedMetadata:crashes inserting it into anNSMutableArray:Fix
Gate the fake-URL trick on iOS < 26 with
@available(iOS 26.0, *). On iOS 26 and later, leaveoriginalURLunset (defaults tonil). The share sheet still works — the title and image preview both still render — but the size/extension subtitle that the fake URL was producing is no longer shown on iOS 26+.That tradeoff matches what the reporter on #3784 already suggested:
PDFs and plain text are unaffected, and pre-iOS 26 behaviour is unchanged.
Test plan
.docxfile, confirm no crash..docxfile, confirm subtitle still shows ("DOCX • 500 KB").metadata.imageProviderpath is unaffected).I do not currently have an iOS 26 simulator to run the repro myself; opening as a draft so a maintainer or CI can validate the iOS 26 behaviour before this is marked ready.
Risks
originalURLvalues, this gate could be removed; for nowiOS 26.0is the safe lower bound based on the reproduction in [Bug]: share_plus iOS 26 crash — NSArrayM insertObject:atIndex: nil object in SHSheetActivityItemsManager when sharing DOCX files #3784.Related
sharePositionOrigin(PR fix(share_plus): avoid crash on iOS 26 on iPads with no sharePosition… #3769).sharePositionOrigin must be setcrash.