Skip to content

Default AppDelegate calls missing FlutterAppDelegate method application:openURL:options: (Google Sign in crash) #10106

@collinjackson

Description

@collinjackson

Steps to Reproduce

Replace the AppDelegate.m in the Google Sign In example with the default AppDelegate.m from flutter create.

Try to sign in on iOS. You'll get a crash after signing in because it calls a method that doesn't exist.

A possible short term fix is that the template shouldn't include this:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return [super application:application openURL:url options:options];
}

Instead it should include this:

- (BOOL)application:(UIApplication*)application
            openURL:(NSURL*)url
  sourceApplication:(NSString*)sourceApplication
         annotation:(id)annotation {
  // Called when the application is asked to open a resource specified by a URL.
  return [super application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}

Long term fix is for FlutterAppDelegate to implement both, or to fix #9984.

Logs

May 16 08:09:34 jackson-macbookpro Runner[62559]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate application:openURL:options:]: unrecognized selector sent to instance 0x610000053b60'
	*** First throw call stack:
	(
		0   CoreFoundation                      0x000000010bb2cb0b __exceptionPreprocess + 171
		1   libobjc.A.dylib                     0x000000010e612141 objc_exception_throw + 48
		2   CoreFoundation                      0x000000010bb9c134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
		3   CoreFoundation                      0x000000010bab3656 ___forwarding___ + 534
		4   CoreFoundation                      0x000000010bab33b8 _CF_forwarding_prep_0 + 120
		5   Runner                              0x000000010b4769e4 -[AppDelegate application:openURL:options:] + 148
		6   UIKit                               0x000000010f1d7a1d __45-[UIApplication _applicationOpenURL:payload:]_block_invoke + 813
		7   UIKit                               0x000000010f1d7456 -[UIApplication _applicationOpenURL:payload:] + 707
		8   SafariServices                      0x000000010dde2687 -[SFSafariViewController remoteViewController:hostApplicationOpenURL:] + 158
		9   SafariServices                      0x000000010ddd9f57 -[SFBrowserRemoteViewController willOpenURLInHostApplication:] + 68
		10  CoreFoundation                      0x000000010bab4c6c __invoking___ + 140
		11  CoreFoundation                      0x000000010bab4b40 -[NSInvocation invoke] + 320
		12  FrontBoardServices                  0x0000000113cee5f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
		13  FrontBoardServices                  0x0000000113cee46d -[FBSSerialQueue _performNext] + 186
		14  FrontBoardServices                  0x0000000113cee7f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
		15  CoreFoundation                      0x000000010bad2c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
		16  CoreFoundation                      0x000000010bab80cf __CFRunLoopDoSources0 + 527
		17  CoreFoundation                      0x000000010bab75ff __CFRunLoopRun + 911
		18  CoreFoundation                      0x000000010bab7016 CFRunLoopRunSpecific + 406
		19  GraphicsServices                    0x00000001121e5a24 GSEventRunModal + 62
		20  UIKit                               0x000000010f1cd0d4 UIApplicationMain + 159
		21  Runner                              0x000000010b476a9f main + 111
		22  libdyld.dylib                       0x0000000110baf65d start + 1
	)
May 16 08:09:34 jackson-macbookpro Runner[62559]: 2017-05-16 08:09:34.190 Runner[62559:28025627] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate application:openURL:options:]: unrecognized selector sent to instance 0x610000053b60'

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.4 16E195, channel unknown)
• Flutter at /Users/jackson/git/flutter
• Framework revision dc4ca8d (5 days ago), 2017-05-11 15:33:29 -0700
• Engine revision f99d3ef
• Tools Dart version 1.23.0-dev.11.11

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /Users/jackson/Library/Android/sdk/
• Platform android-25, build-tools 25.0.3
• ANDROID_HOME = /Users/jackson/Library/Android/sdk/
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.1, Build version 8E1000a
• ios-deploy 1.9.1
• CocoaPods version 1.0.1

[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Gradle version 3.2
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2016.3.4)
• Dart plugin version 163.13137
• Flutter plugin version 12.1

[✓] Connected devices
• iPhone 7 Plus • 5F90A4C3-6F80-446A-88CB-5394635BF8EF • ios • iOS 10.3 (simulator)

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolepackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions