-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Quick Actions events are never called #13634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @cbracken |
I am running on Xiami 5A. |
I'm having this error too on my iPhone. |
I found a temporary solution to the problem. Add the following code to your AppDelegate file: - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/quick_actions" binaryMessenger:controller];
[channel invokeMethod:@"launch" arguments:shortcutItem.type];
} |
@DanielSmith1239 Thank you, it works! :) I hope it will be fixed though. |
Thanks @DanielSmith1239 thats works for iOS! Do we need to add anything for Android? |
quick_actions code provided in repo for the package /example does not work at all on iOS 12.x. |
@workerbee22 if you add the code to the app delete it works perfectly |
Added @DanielSmith1239 code to project into /ios/runner/appdelegate.m still nothing using the Pub version of the package 0.2.2. Did a flutter clean first ... nope nothing, regardless of if the app is running or not. |
You guys are right !!! But traps for Flutter devs not accustomed to the iOS environment are:
iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone 8, iPhone 8 Plus, iPhone X, iPhone Xs, iPhone Xs Max
Then it works including the fix in AppDelegate.m from @DanielSmith1239 . Also seems to work if the app is running in the background, or from cold start of the app. |
for those who use swift as a IOS language. the code below is useful to run quick actions.
|
Remember to upvote this issue so the Flutter Team can give it a priority if it deserve it. |
For anyone curious this is what the AppDelagate.swift should look like with the latest swift syntax: import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
@available(iOS 9.0, *)
override func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
let controller = window.rootViewController as? FlutterViewController
let channel = FlutterMethodChannel(name: "plugins.flutter.io/quick_actions", binaryMessenger: controller!)
channel.invokeMethod("launch", arguments: shortcutItem.type)
}
} |
Thank you for this! Could not figure out why those actions were not being triggered. Worked perfect. |
The previous Swift solutions weren't compiling import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
// Required for the quick_actions package
@available(iOS 9.0, *)
override func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let channel = FlutterMethodChannel(name: "plugins.flutter.io/quick_actions", binaryMessenger: controller.binaryMessenger)
channel.invokeMethod("launch", arguments: shortcutItem.type)
}
} |
Works for me, thanks. But only if the App is already Running in the background. Unfortunately it does not work with a cold Start |
I'm facing this issue but only on my most recent app. Android works flawlessly. |
PerformActionFor::shortcutItem won't get called from cold start. Instead, the didFinishLaunchingWithOptions will get called from cold start. You need to check the launchOption in didFinishLaunhingWIthOptions for the shortcutItem, store to a variable and handle it in applicationDidBecomeActive. Here are the codes:
|
@Vanilo This works like a charm! Are there any technical limitations that prevent this plugin from making this process easier? Ideally, we wouldn't need to touch |
@britannio I'm afraid this is the only way to do it as far as I know. There are only a few features that would require to make changes like this. |
@Vanilo thanks man! worked for me as well |
@Vanilo Does this look relevant? flutter/plugins#2887 |
Wondering if this is still an issue. A fix is supplied since version 0.5.0 and since then I cannot reproduce the problem anymore. The fix only listens to the If you still experience the issue, would you please provide the following information:
|
Hi @mvanbeusekom |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
quickActions.initialize((String shortcutType)
is never called.Item are presented under IOS but a selection always return the default main widget
and debugger is never triggered under initialize(). Simple print never display the message.
V 0.0.2
The text was updated successfully, but these errors were encountered: