I'm implementing Google Sign in. To do that, I need to call PFUser.register(self, forAuthType: "google").
When the user is logged out and tries to sign in with Google again, the app calls PFUser.register(self, forAuthType: "google") again and apparently gets a crash on this:
PFConsistencyAssert(![self authenticationDelegateForAuthType:authType],
@"Authentication delegate already registered for authType `%@`.", authType);
How do I unregister my previous delegate then to avoid this crash?
You should register those only once at app launch. Does it help?
Unfortunately, no. I use workers to encapsulate logging in work, I don't store them in memory.
I tried to make my GoogleAuthWorker singleton, but unit tests are crashing anyway.
What do you mean you use workers? is it a macOS app? Or an iOS app?
iOS app. Workers are just classes doing all the job :) Don't go too deep, this is the architecture I use.
But you can register the auth handled at the same time you initialize parse and you鈥檒l be fine no? What prevents you to do that?
But you can register the auth handled at the same time you initialize parse and you鈥檒l be fine no? What prevents you to do that?
Workers are tied with UIViewControllers. I don't have any worker initialized when the app is launched.
so I suggest you revise your architecture as you鈥檙e misusing the feature. You can have a look at the FacebookUtils repository for a complete example. Also, the authentication delegate is just used for validating / restoring authentication data, which is not per-viewController.
I face the same error but I am using the apple signin, did you find the solution? please let me know, thanks.