diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 72fa8344f64a..472a6e8b1fd4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -159,8 +159,13 @@ - (BOOL)application:(UIApplication*)application FML_LOG(ERROR) << "Timeout waiting for the first frame when launching an URL."; } else { + NSString* pathAndQuery = url.path; + if ([url.query length] != 0) { + pathAndQuery = + [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; + } [flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute" - arguments:url.path]; + arguments:pathAndQuery]; } }]; return YES; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm index abbfafc919c2..6a62697dbfe3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm @@ -30,7 +30,7 @@ - (void)skip_testLaunchUrl { appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; - NSURL* url = [NSURL URLWithString:@"http://example.com"]; + NSURL* url = [NSURL URLWithString:@"http://myApp/custom/route?query=test"]; NSDictionary* options = @{}; BOOL result = [appDelegate application:[UIApplication sharedApplication] openURL:url @@ -39,7 +39,7 @@ - (void)skip_testLaunchUrl { return @{@"FlutterDeepLinkingEnabled" : @(YES)}; }]; XCTAssertTrue(result); - OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]); + OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]); } @end