Reputation: 11
I have some problem when use package workmanager. Here is error: [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(unhandledMethod("registerPeriodicTask") error, Unhandled method registerPeriodicTask, null, null)
How to solve this problem ???
Upvotes: 1
Views: 2070
Reputation: 50
This error occurs when there is a mismatch between the expected method or configuration and whats actually implemented or configd in code.
Some steps that can help your problem get resolved:
Update the package by running flutter pub upgrade workmanager
Check configuration
Permission: Ensure that flutter has necessary permissions to execute background tasks
Clen and rebuild you flutter by following commands. flutter clean
, flutter pub get
and flutter run
Check for typos and imports
Check for platform specific code
The workmanager
package is subject to updates and changes so refer to the package's documentation.
Now,
In the project.pbxproj
filelocate the system capabilities section that would look like this
/* Begin PBXProject section */
...
/* End PBXProject section */
Here you can add system capabilities like you want to enable the background fetch capability then you would add something like this:
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
items = (
{
enabled = 1;
value = backgroundFetch;
},
);
};
};
now modify the com.apple.BackgroundModes
key to match the specific capability you want to enable or say configure. Configure in Xcode and Build and Run again!
Thanks
Upvotes: 2