From 7e18814274e060b08081237dea87175f7f8cda8b Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Sun, 19 Oct 2025 22:42:07 +0300 Subject: [PATCH 1/2] fix(share_plus): Avoid crash on iOS 26 on iPhones with no sharePositionOrigin --- .../share_plus/example/ios/Flutter/AppFrameworkInfo.plist | 2 +- .../share_plus/example/ios/Runner.xcodeproj/project.pbxproj | 6 +++--- .../Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | 3 +++ .../ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m | 5 ++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist b/packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist index 7c56964006..1dc6cf7652 100644 --- a/packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj b/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj index 2a3b6e0036..4d97ee1163 100644 --- a/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj @@ -451,7 +451,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -578,7 +578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -627,7 +627,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8e3ca5dfe1..e3773d42e2 100644 --- a/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m b/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m index 974602bd32..9dd3c42327 100644 --- a/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m +++ b/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m @@ -420,10 +420,13 @@ + (void)share:(NSArray *)shareItems BOOL isCoordinateSpaceOfSourceView = CGRectContainsRect(controller.view.frame, origin); + // Check if this is actually an iPad + BOOL isIpad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); + // If device is e.g. an iPad then hasPopoverPresentationController is true BOOL hasPopoverPresentationController = [activityViewController popoverPresentationController] != NULL; - if (hasPopoverPresentationController && + if (isIpad && hasPopoverPresentationController && (!isCoordinateSpaceOfSourceView || CGRectIsEmpty(origin))) { NSString *sharePositionIssue = [NSString stringWithFormat: From eaa170e26f0a17b40e1e2cbb5c70314c69a1b264 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Sun, 19 Oct 2025 23:05:05 +0300 Subject: [PATCH 2/2] docs(share_plus): Improve comment in native iOS part --- .../ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m b/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m index 9dd3c42327..59b7e93ae7 100644 --- a/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m +++ b/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m @@ -423,7 +423,8 @@ + (void)share:(NSArray *)shareItems // Check if this is actually an iPad BOOL isIpad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); - // If device is e.g. an iPad then hasPopoverPresentationController is true + // Before Xcode 26 hasPopoverPresentationController is true for iPads and false for iPhones. + // Since Xcode 26 is true both for iPads and iPhones, so additional check was added above. BOOL hasPopoverPresentationController = [activityViewController popoverPresentationController] != NULL; if (isIpad && hasPopoverPresentationController &&