flutter_workmanager
flutter_workmanager copied to clipboard
using this package app was not build in android or IOS both
`import UIKit import Flutter import workmanager import flutter_background_service_ios
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SwiftFlutterBackgroundServicePlugin.taskIdentifier = "your.custom.task.identifier"
GeneratedPluginRegistrant.register(with: self)
UNUserNotificationCenter.current().delegate = self
WorkmanagerPlugin.setPluginRegistrantCallback { registry in
GeneratedPluginRegistrant.register(with: registry)
}
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.taskId")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.rescheduledTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.simpleDelayedTask")
WorkmanagerPlugin.registerBGProcessingTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask")
WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "be.tramckrijte.workmanagerExample.iOSBackgroundAppRefresh", frequency: NSNumber(value: 20 * 60))
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler(.alert)
}
} `
Errors ::
/Users/nikunj/Flutter Project.O/PrishuSoft/ZuguMobileAppLatest/zugu-ring/ios/Runner/AppDelegate.swift:23:27 Type 'WorkmanagerPlugin' has no member 'registerBGProcessingTask'
/Users/nikunj/Flutter Project.O/PrishuSoft/ZuguMobileAppLatest/zugu-ring/ios/Runner/AppDelegate.swift:24:27 Type 'WorkmanagerPlugin' has no member 'registerBGProcessingTask'
/Users/nikunj/Flutter Project.O/PrishuSoft/ZuguMobileAppLatest/zugu-ring/ios/Runner/AppDelegate.swift:25:27 Type 'WorkmanagerPlugin' has no member 'registerBGProcessingTask'
/Users/nikunj/Flutter Project.O/PrishuSoft/ZuguMobileAppLatest/zugu-ring/ios/Runner/AppDelegate.swift:26:27 Type 'WorkmanagerPlugin' has no member 'registerBGProcessingTask'
/Users/nikunj/Flutter Project.O/PrishuSoft/ZuguMobileAppLatest/zugu-ring/ios/Runner/AppDelegate.swift:28:27 Type 'WorkmanagerPlugin' has no member 'registerPeriodicTask'
I have same error
These compilation errors are due to using outdated API calls. The methods and on have been updated. With the recent plugin modernization in v0.7.0 and upcoming v0.7.1, these APIs have been fixed. Please update to the latest version and refer to the updated documentation and example app.