使用访问组快速登录用户无法正常工作 [英] Swift Signing User in with Access Group not working

查看:30
本文介绍了使用访问组快速登录用户无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序内部,我想使用 Auth.auth().useUserAccessGroup 登录用户.

Inside my app I would like to sign in the user using Auth.auth().useUserAccessGroup.

这是我用于通过电子邮件登录的代码(用户也可以使用Facebook,Google和Apple登录)

This is my code for signing in with email (user can also sign in with Facebook, Google & Apple):

注册功能:

static func signUpWithEmail(email: String, password: String, username: String, finished: @escaping (_ done: Bool) -> Void){
    
    do {
        try Auth.auth().useUserAccessGroup("SN26HDFT24.com.wishlists-app.group")
    } catch let error as NSError {
        print("Error changing user access group: %@", error)
    }
    Auth.auth().createUser(withEmail: email, password: password) { (result, error) in
        
        if let error = error {
            Utilities.showErrorPopUp(labelContent: "Fehler", description: error.localizedDescription)
            finished(false)
        }
        
        if let userId = result?.user.uid { 

             // successfully signed in

        } else {
            print("user couldn't sign in")
            finished(false)
        }
    }
}

钥匙串共享:

问题:

当调用此函数 if let error = error 时,此操作将失败:

When calling this function if let error = error this fails:

@c NSError.userInfo词典中的@c NSLocalizedFailureReasonErrorKey字段将包含有关遇到的错误的更多信息.UserInfo = {FIRAuthErrorUserInfoNameKey = ERROR_KEYCHAIN_ERROR,NSLocalizedFailureReason = SecItemCopyMatching(-34018),NSLocalizedDescription =访问钥匙串时发生错误.@c NSError.userInfo字典中的@c NSLocalizedFailureReasonErrorKey字段将包含有关遇到的错误的更多信息}

The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered" UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_KEYCHAIN_ERROR, NSLocalizedFailureReason=SecItemCopyMatching (-34018), NSLocalizedDescription=An error occurred when accessing the keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered}

因此,当我第一次调用它时,尝试Auth.auth().useUserAccessGroup("SN26HDFT24.com.wishlists-app.group")实际上会成功,至少不会抛出异常任何东西.

so the first time I am calling it, try Auth.auth().useUserAccessGroup("SN26HDFT24.com.wishlists-app.group") actually succeeds, at least it is not throwing anything.

但是再次调用它时, do try块失败.具有与上面相同的错误消息.

But when calling it again it the do try block fails. With the same error-message as above.

权利:

功能:

我被困住了.在任何地方都找不到任何东西...

I am stuck. Couldn't find anything on this anywhere...

这是我的共享扩展名

推荐答案

我不知道这种情况如何发生,但是访问组的字符串在您的应享权利中是错误的.

I don't know how this could happen, but the string for the access group is wrong in your entitlements.

应为 $(AppIdentifierPrefix)com.wishlists-app.group ,而不是 $(AppIdentifierPrefix)SN26HDFT24.com.wishlists-app.group .

您的扩展程序必须已激活相同的应用程序组和钥匙串组.我看不到您的应用扩展程序的任何内容.然后,您还必须在扩展程序中调用 useUserAccessGroup("SN26HDFT24.com.wishlists-app.group").

Your extension must have the same app group and keychain group activated. I can't see anything of your app extension. Then you must also call useUserAccessGroup("SN26HDFT24.com.wishlists-app.group") in your extension.

这篇关于使用访问组快速登录用户无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆