Swift 通过firebase登录获取更大的facebook图像

Swift 通过firebase登录获取更大的facebook图像,swift,facebook-graph-api,firebase,facebook-login,firebase-authentication,Swift,Facebook Graph Api,Firebase,Facebook Login,Firebase Authentication,我正在使用firebase通过facebook登录用户。这一切都很好,我可以得到用户的FB配置文件图像,虽然它是小。有人能告诉我如何得到一个更大的,我正在使用的代码: override func viewDidLoad() { let loginButton = FBSDKLoginButton() loginButton.readPermissions = ["public_profile", "email"]

我正在使用firebase通过facebook登录用户。这一切都很好,我可以得到用户的FB配置文件图像,虽然它是小。有人能告诉我如何得到一个更大的,我正在使用的代码:

     override func viewDidLoad() {
            let loginButton = FBSDKLoginButton()
            loginButton.readPermissions = ["public_profile", "email"]
            loginButton.delegate = self
            self.view.addSubview(loginButton) 
        }

func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError?) {

        let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString)

            FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
                if let user = FIRAuth.auth()?.currentUser {
                for profile in user.providerData {
                let photoUrl = profile.photoURL?.absoluteString //SMALL IMAGE
                   }
                }
            }
        }
这是在swift中完成的

根据Facebook的个人资料图片,您应该能够通过在url中添加宽度和高度来指定大小:

let photoUrl = profile.photoURL?.absoluteString + "?width=\(width)&height=\(height)"
或通过指定类型:

let photoUrl = profile.photoURL?.absoluteString + "?type=large"

FB用户身份验证后,使用FBSDKGraphRequestConnection发出FBSDKGraphRequest请求以获取用户FBid,您可以通过在此处插入id来获取用户配置文件图片:

/图片?类型=大并返回\u ssl\u资源=1

您可以使用?宽度=&高度=也,而不是类型=大


一旦您获得照片Url,只需在照片Url中添加?width=400&height=400即可。在这里,height=width=400,您可以选择自己的高度和宽度。它确实有效

如果您想使用facebook API检索图片,但他要求通过firebase进行检索,并且如果您附加+?type=large或+?width=width&height=height,则页面为空无图片您是否设法解决了此问题?你能发布解决方案吗?谢谢,我稍后会给你回复,因为我记不起来我需要检查代码。如果你找到了解决方案,请发布here@HenryBrown你查过密码了吗?很抱歉,我有点受不了了,我还没找到解决办法:对不起,我花了这么长时间。我一直很忙。我在下面标出了正确答案。我使用了:let photoUrl=profile.photoUrl?.absoluteString+?type=large这对我来说不起作用。这只适用于facebook graph API。它不适用于Firebase auth。