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

[Bug?] Unsafe to call useUserAccessGroup immediately after FirebaseApp.configure() #4175

Closed
mobmad opened this issue Oct 26, 2019 · 1 comment · Fixed by #5387
Closed

[Bug?] Unsafe to call useUserAccessGroup immediately after FirebaseApp.configure() #4175

mobmad opened this issue Oct 26, 2019 · 1 comment · Fixed by #5387
Assignees

Comments

@mobmad
Copy link

mobmad commented Oct 26, 2019

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 11.1 (11A1027)
  • Firebase SDK version: 6.11
  • Firebase Component: Auth
  • Component version: 6.3.1

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  1. Follow the steps in Enabling cross-app authentication with shared iOS Keychain
  2. Do the following:
// ... inside application(_:didFinishLaunchingWithOptions:):
FirebaseApp.configure()

do {
    try Auth.auth().useUserAccessGroup("TEAMID.com.example.group1")
    print("useUserAccessGroup OK")
} catch let error as NSError {
    print("useUserAccessGroup failed with \(error)")
}

Expected output:
useUserAccessGroup OK

Actual output:
useUserAccessGroup failed with Error Domain=Foundation._GenericObjCError Code=0 "(null)"

My analysis

It seems like there is some async setup going on which prevents this from working. If I wrap the useUserAccessGroup call with

DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
	do {
	    try Auth.auth().useUserAccessGroup("TEAMID.com.example.group1")
	    print("useUserAccessGroup OK")
	} catch let error as NSError {
	    print("useUserAccessGroup failed with \()")
	}
}

or move it out of application(_:didFinishLaunchingWithOptions:): and call it later it works as expected.

I think this is a bug, but if it's not, I would suggest improving the error message to something more helpful.

@paulb777
Copy link
Member

@mobmad Thanks for the report and we're very sorry about the long delay to respond.

I'm able to reproduce the issue and working on a fix at #5387

@paulb777 paulb777 assigned paulb777 and unassigned renkelvin Apr 15, 2020
@firebase firebase locked and limited conversation to collaborators May 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants