Ios 快速登录facebook可以';你没有收到电子邮件吗?

Ios 快速登录facebook可以';你没有收到电子邮件吗?,ios,swift,facebook,Ios,Swift,Facebook,大家好,我正在使用的社交媒体登录(Facebook、Google、Twitter)除Facebook外,所有这些都有效。当ı尝试登录Facebook时,它不会被记录,因为“电子邮件”无法接收 你可以在图片上看到,没有关于未来数据的电子邮件 以下是许可部分: func login(from viewController: UIViewController, done: @escaping(_ status: Bool, _ message: String, _ user: DTFaceb

大家好,我正在使用的社交媒体登录(Facebook、Google、Twitter)除Facebook外,所有这些都有效。当ı尝试登录Facebook时,它不会被记录,因为“电子邮件”无法接收

你可以在图片上看到,没有关于未来数据的电子邮件

以下是许可部分:

    func login(from viewController: UIViewController, done: @escaping(_ status: Bool, _ message: String, _ user: DTFacebookUser?) -> Void) {
    let login = FBSDKLoginKit.LoginManager()
    login.defaultAudience = .everyone
    if scopes.count == 0 {
        scopes = ["public_profile", "email"]
    }
    
    login.logIn(permissions: scopes, from: viewController) { (result, error) in
        DispatchQueue.main.async {
            if error != nil {
                done(false, error!.localizedDescription, nil)
            }
            else if let result = result {
                if result.isCancelled && result.declinedPermissions.count > 0 {
                    done(false, "facebook_cancel_declined", nil)
                }
                else {
                    //let userID = result.token?.userID
                    self.graph(str: "/me?fields=email,name", done: done)

                }
            }
        }
    }
}
以下是登录操作:

    @objc func actionFacebook() {
    
    self.socialLogin.login(with: .Facebook, from: self) { (error, user) in
        // user.name, user.email, user.id, user.profileImageURL
        if user == nil {
            return
        }
        
        var text = "FACEBOOK LOGIN\n"
        text = "\(text)\nFull Name: \(user!.name)"
        text = "\(text)\nEmail: \(user!.email)"
        text = "\(text)\nUser ID: \(user!.id)"
        text = "\(text)\nImage: \(user!.profileImageURL)"
        
        print(text)
        
        if user!.email == "" {
            return
        }
        
        if user!.name == "" {
            return
        }
        
        if self.passSignType == "Login"
        {
            ServiceManager.shared.Authenticate(Phone: "", MobilePin: "", Email: user!.email, Password: "", ProviderName: "Facebook", ProviderId: user!.id, ProviderToken: "", Name: user!.name, Username: user!.name, ActionType: "Login", callbackSuccess: { (response) in
                
                HUD.flash(.label("hudAccountLogin".localized()), delay: 1.0) { _ in
                    
                }
                
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                    self.dismiss(animated: true) {
                        
                    }
                    NotificationCenter.default.post(name: Notification.Name(rawValue: "UserLogged"), object: nil)
                }
                                    
            }) { (response) in
                
                HUD.flash(.label("hudFailed".localized()), delay: 1.0) { _ in
                    
                }
            }
        }
    }
我无法解决Facebook上没有电子邮件的问题…

登录后(权限…)API使用GraphRequestConnection获取用户信息

    func getFbUserProfileInfo() {
    let connection  = GraphRequestConnection()
    connection.add(GraphRequest(graphPath: "/me", parameters: ["fields" : "id,first_name,last_name,email,name"], tokenString: AccessToken.current?.tokenString, version: Settings.defaultGraphAPIVersion, httpMethod: .get)) { (connection, values, error) in
        if let res = values {
            if let response = res as? [String: Any] {
                let username = response["name"]
                let email = response["email"]
            }
        }
    }
    connection.start()
}

这回答了你的问题吗?