From b41ad11929b196430d2f765bd1b44363901d3e57 Mon Sep 17 00:00:00 2001 From: Fajrian Aidil Pratama Date: Sat, 12 Sep 2026 23:48:53 +0700 Subject: [PATCH 1/2] fix(apple): prevent double completionHandler call in PhonePermissionStrategy checkServiceStatus called completionHandler with ServiceStatusNotApplicable when canOpenURL: returned NO, but fell through to call completionHandler again with the enabled/disabled status since there was no early return. Flutter result callbacks must only be invoked once; the second call can crash on devices that can't open tel:// URLs (e.g. iPad). --- .../strategies/PhonePermissionStrategy.m | 1 + 1 file changed, 1 insertion(+) diff --git a/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m b/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m index 6944a9835..6b324b6d0 100644 --- a/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m +++ b/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m @@ -21,6 +21,7 @@ - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(Servic NSURL *telURL = [NSURL URLWithString:@"tel://"]; if (![app canOpenURL:telURL]) { completionHandler(ServiceStatusNotApplicable); + return; } completionHandler([self canDevicePlaceAPhoneCall] ? ServiceStatusEnabled : ServiceStatusDisabled); } From a066ca08d838ae5e033df5f32b451ca70e2a86c2 Mon Sep 17 00:00:00 2001 From: Fajrian Aidil Pratama Date: Sun, 20 Sep 2026 10:00:05 +0800 Subject: [PATCH 2/2] refactor(apple): use if/else instead of early return in PhonePermissionStrategy Makes the mutual exclusivity of the two completionHandler branches structural rather than implied by control flow, per review feedback from @ibrahim-iqbal. --- .../strategies/PhonePermissionStrategy.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m b/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m index 6b324b6d0..a9f60bf2b 100644 --- a/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m +++ b/permission_handler_apple/ios/permission_handler_apple/Sources/permission_handler_apple/strategies/PhonePermissionStrategy.m @@ -21,9 +21,9 @@ - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(Servic NSURL *telURL = [NSURL URLWithString:@"tel://"]; if (![app canOpenURL:telURL]) { completionHandler(ServiceStatusNotApplicable); - return; + } else { + completionHandler([self canDevicePlaceAPhoneCall] ? ServiceStatusEnabled : ServiceStatusDisabled); } - completionHandler([self canDevicePlaceAPhoneCall] ? ServiceStatusEnabled : ServiceStatusDisabled); } - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler {