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 fe1ebc3dbf..3d9f3b7bf9 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 @@ -415,22 +415,24 @@ + (void)share:(NSArray *)shareItems [activityViewController setValue:subject forKey:@"subject"]; } - activityViewController.popoverPresentationController.sourceView = - controller.view; - // Check if this is actually an iPad BOOL isIpad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); - // Before Xcode 26 hasPopoverPresentationController is true for iPads and false for iPhones. - // Since Xcode 26 it is true for both iPads and iPhones, so we only configure popover on iPad. + // Before Xcode 26, popoverPresentationController was non-nil only on iPad. + // Since Xcode 26 it is non-nil on iPhone as well, where it is a private + // _UIActivityViewControllerPresentationController rather than a real + // UIPopoverPresentationController. Configuring it on iPhone pushes + // UIActivityViewController onto the anchored presentation path, so restrict + // every popover configuration to iPad. UIPopoverPresentationController *popover = activityViewController.popoverPresentationController; - BOOL hasPopoverPresentationController = (popover != NULL); - CGRect sourceRect = origin; - if (isIpad && hasPopoverPresentationController) { + if (isIpad && popover != nil) { + popover.sourceView = controller.view; + // Flutter sends sharePositionOrigin in global (window) coordinates. // Convert to the source view's coordinate space for sourceRect. + CGRect sourceRect = origin; if (controller.view.window && !CGRectIsEmpty(origin)) { sourceRect = [controller.view convertRect:origin fromView:nil]; } @@ -442,8 +444,6 @@ + (void)share:(NSArray *)shareItems CGRectGetMidY(bounds) - 1.0, 2.0, 2.0); } popover.sourceRect = sourceRect; - } else if (!CGRectIsEmpty(origin)) { - activityViewController.popoverPresentationController.sourceRect = origin; } activityViewController.completionWithItemsHandler =