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
Unhandled method registerOneOffTask in iOS #89
Comments
oh~~maybe I misunderstand, it seems all of the methods are just for android, right? so for ios, just need to set below in the
for let the task run on schedule? so when I execute the |
Refer to the documentation please. iOS automatically schedules 1 task for you. There is no way to specify custom constraints on iOS for now. We will however support this in the future for iOS 13 and up.
Refer to the sample which shows a full sample how to deal with iOS. |
but I tried in xcode and trigger it by manual, I just got below error:
|
Can you share the code that is failing? |
I just tried with your example codes and didn't change anything :( |
@winsonet If I understand correctly, you are saying the sample app does not run? @Kymer or @jeremie-movify Does the sample app still run on iOS? |
yes, my xcode version is : 11.1(11A1027), Swift version is: 4.2
|
Does the sample app run? |
I am observing the exact same things as @winsonet, including error while simulating background fetch from Xcode. The Sample app runs but breaks when I simulate background fetch. My setup is exactly the same. |
Thanks for letting us know. Odd that |
I switched back to version 0.1.1 and was able to successfully simulate background fetch in the example app with the same Xcode 11 setup so will probably use this version. I have one question I would appreciate clarity. For the iOS app, I know there's no guarantee but how frequent can I realistically expect background fetch to be triggered by iOS in my app? Does it happen only once? Once in a couple days? Once daily? I ask because I had the example app running for hours (after initializing workmanager) hoping to see a trigger from iOS to run the background fetch but it didn't happen (it only triggered through the simulated background fetch). |
I think you need to set the frequent in swift code as below:
but I really hope it can fix the issue in latest version! |
Yeah, I did. I copied that same line over to my |
but I tried to back to 0.1.1 it's also not working, the same error for me :( |
Did you close Xcode and reopen? Firstly though, I think I did My ExperienceWhen I downgraded to 0.1.1, I tried building it from VS Code first and got some errors relating to changed Swift APIs. I tried to google the errors. I think I made adjustments to two files before it built and ran:
After that I stopped the app and jumped on XCode to run the app and then was able to simulate the background fetch. |
hum...sorry, I can't find any codes what you mentioned in that's files:( there is no
and also no
and I have clean and rebuild the flutter sample project , after that just open Xcode to run again... |
Okay, can't get those swift errors again. I deleted the repo and cloned again, then opened the |
I just find an interesting thing that I can't back to 0.1.1 version, even I set |
I dunno, maybe removing the workmanager: 0.1.1 |
thanks for your reply, when I remove the |
About the error. I've got that:
There is 2 cases I found. First, the FlutterResult is not an scalar or string anymore - it is an Object... And second, even if I hardcode the result as UIBackgroundFetchResult.newData, the error is gone. But the dart code inside of callbackDispatcher is not executing. Xcode: 10.3, Swift 4.2 |
Thank you for the investigation we will pick this up on monday 😀 |
Woah... the problem in my case was in my dart code inside of callbackDispatcher... it throws an error inside. Wrapping code in try...catch shows that SharedPreferences are failed. On Android platform all works fine, but it is another story... So, try... catch is really helps find out what exactly is going on. Maybe It is good to note about in the docs, I suppose. |
What do you mean? There is nothing magic about the |
Yep, SharedPreferences are not working in IOS.
result:
Flutter: 1.7.8+hotfix4 About the magic)) I've coded my app, it was tested and worked like a charm) but on Android. When I switched to IOS, and tried to test 'Simulate Background Fetch' option to run my code, I've got a XCODE that stops on line 115 of SwiftWorkmanagerPlugin.swift with the message that I've posted earlier.
And no more. Nothing about Shared or Preferences or even any of Exceptions. It is hard to figure out what is going on. And where the problem is (your code or plugin code, or else). Especially if on the other platform (Android) all is working well. Maybe that would save someone couple of hours of issues checking...))) |
It seems we have an extra issues then on iOS if plugins are not registered in the plugins. |
Sample works well, just because IOS notify event in callback actually doesn't use any other plugins!
error:
|
@winsonet @raphaelakpan I have pushed a fix (#94) for the failing @alp1396 If you want to use other plugins in iOS' background fetch you need to make sure you set the
|
that's grate!!! it's working, thanks a lot!! |
I am also facing similar issue on iOS. I followed the setup guide. My plugin version is My code looks like
when I want to invoke it is
The
The error is
I tried with Any help appreciated. |
same issue :< I still dont know how to resolve |
Please give any update on this issue i am also facing this same issue |
registerOneOffTask was previously unsupported on iOS, but now has a limited implementation in version |
it's works fine in my android but for iOS I always get below errors:
in my
AppDelegate.swift
fileany ideas?
thanks!
The text was updated successfully, but these errors were encountered: