小编loo*_*139的帖子

如何在 AppDelegate.swift 中向 Workmanager 注册“特定插件”?

我一直在关注Flutter Workmanager iOS 设置,在页面底部,他们展示了如何将插件与 Workmanager 一起使用来执行后台任务。

我的 AppDelegate.swift 中有这个确切的代码:

class AppDelegate: FlutterAppDelegate {
    /// Registers all pubspec-referenced Flutter plugins in the given registry.  
    static func registerPlugins(with registry: FlutterPluginRegistry) {
            GeneratedPluginRegistrant.register(with: registry)
    }
    
    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        // ... Initialization code
        
        AppDelegate.registerPlugins(with: self) // Register the app's plugins in the context of a normal run
        
        WorkmanagerPlugin.setPluginRegistrantCallback { registry in  
            // The following code will be called upon WorkmanagerPlugin's registration.
            // Note …
Run Code Online (Sandbox Code Playgroud)

plugins ios flutter

3
推荐指数
1
解决办法
1905
查看次数

标签 统计

flutter ×1

ios ×1

plugins ×1