Skip to content
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

Delete hangs #3

Open
amandaoneal opened this issue Jun 18, 2022 · 2 comments
Open

Delete hangs #3

amandaoneal opened this issue Jun 18, 2022 · 2 comments

Comments

@amandaoneal
Copy link

When I try to call the delete method, it hangs indefinitely. I think it's related to the fact that SwiftCloudPlugin.swift doesn't have a result() call for the delete case, so while it does perform the operation, it doesn't actually end the method and return back to Flutter. If this is the case, I suspect deleteAll would have the same issue, though I haven't tested that one.

@Tutorialwork
Copy link
Owner

Tutorialwork commented Jun 22, 2022

There is an implementation for the delete() and deleteAll() function.

I can't reproduce your issue. Can you provide more information like an error message or something else?

@amandaoneal
Copy link
Author

amandaoneal commented Jun 28, 2022

I'm on Flutter 3.0.2 / Dart 2.17.3 / DevTools 2.12.2. This is happening on iOS in particular (haven't tested on Android yet).

There's no error message that I'm aware of, it just hangs (from Dart's perspective anyway)

Dart Code:

print("here1");
await prefs.setString(ServerHandler.fcmTokenKey, token);
print("here2");
await cloudKit.delete(ServerHandler.fcmTokenKey);
print("here3");

In the above code, it prints "here1" and "here2" but never prints "here3", it just sits indefinitely on the delete() line.

I was able to fix it locally by adding a result() call inside SwiftCloudPlugin.swift:

case "delete":
...
if record.value(forKey: key) != nil {
   database.delete(withRecordID: record.recordID) { (recordId, error) in
      result(true) //ADDED THIS LINE
   }                        
}

I haven't yet figured out how to fix it for deleteAll because (1) I'm not super familiar with Swift closures and (2) I don't need to use deleteAll for my code. But I assume a similar fix would work for deleteAll?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants