Skip to content

Commit 42b079b

Browse files
authored
fix(share_plus): Avoid crash on iOS 26 on iPhones with no sharePositionOrigin (#3699)
1 parent 4cc3f07 commit 42b079b

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>13.0</string>
2525
</dict>
2626
</plist>

packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
452452
GCC_WARN_UNUSED_FUNCTION = YES;
453453
GCC_WARN_UNUSED_VARIABLE = YES;
454-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
454+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
455455
MTL_ENABLE_DEBUG_INFO = NO;
456456
SDKROOT = iphoneos;
457457
SUPPORTED_PLATFORMS = iphoneos;
@@ -578,7 +578,7 @@
578578
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
579579
GCC_WARN_UNUSED_FUNCTION = YES;
580580
GCC_WARN_UNUSED_VARIABLE = YES;
581-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
581+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
582582
MTL_ENABLE_DEBUG_INFO = YES;
583583
ONLY_ACTIVE_ARCH = YES;
584584
SDKROOT = iphoneos;
@@ -627,7 +627,7 @@
627627
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
628628
GCC_WARN_UNUSED_FUNCTION = YES;
629629
GCC_WARN_UNUSED_VARIABLE = YES;
630-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
630+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
631631
MTL_ENABLE_DEBUG_INFO = NO;
632632
SDKROOT = iphoneos;
633633
SUPPORTED_PLATFORMS = iphoneos;

packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -54,11 +55,13 @@
5455
buildConfiguration = "Debug"
5556
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5657
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5759
launchStyle = "0"
5860
useCustomWorkingDirectory = "NO"
5961
ignoresPersistentStateOnLaunch = "NO"
6062
debugDocumentVersioning = "YES"
6163
debugServiceExtension = "internal"
64+
enableGPUValidationMode = "1"
6265
allowLocationSimulation = "YES">
6366
<BuildableProductRunnable
6467
runnableDebuggingMode = "0">

packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,14 @@ + (void)share:(NSArray *)shareItems
420420
BOOL isCoordinateSpaceOfSourceView =
421421
CGRectContainsRect(controller.view.frame, origin);
422422

423-
// If device is e.g. an iPad then hasPopoverPresentationController is true
423+
// Check if this is actually an iPad
424+
BOOL isIpad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad);
425+
426+
// Before Xcode 26 hasPopoverPresentationController is true for iPads and false for iPhones.
427+
// Since Xcode 26 is true both for iPads and iPhones, so additional check was added above.
424428
BOOL hasPopoverPresentationController =
425429
[activityViewController popoverPresentationController] != NULL;
426-
if (hasPopoverPresentationController &&
430+
if (isIpad && hasPopoverPresentationController &&
427431
(!isCoordinateSpaceOfSourceView || CGRectIsEmpty(origin))) {
428432
NSString *sharePositionIssue = [NSString
429433
stringWithFormat:

0 commit comments

Comments
 (0)