You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Facebook iOS SDK 18.0.0有限登录时friendIDs始终为nil的问题

有限登录模式下Facebook iOS SDK 18.0.0无法获取好友列表问题

环境信息

  • Xcode版本:16.2
  • Facebook iOS SDK版本:18.0.0
  • 登录模式:有限登录(Limited Login)

实现代码

let loginManager = LoginManager()

// Ensure the configuration object is valid
guard let configuration = LoginConfiguration(
    permissions:["email", "user_friends", "public_profile"],
    tracking: .limited,
    nonce: "123"
)
else {
    return
}

loginManager.logIn(configuration: configuration) { result in
    switch result {
    case .cancelled, .failed:
        // Handle error
        break
    case .success:
        // getting user ID
        let userID = Profile.current?.userID
        
        // getting pre-populated friends list
        let friendIDs = Profile.current?.friendIDs

        // friendIDs is always nil
    }
 }

问题详情

我按照Facebook官方文档实现了有限登录逻辑,尝试获取用户好友列表,但Profile.current?.friendIDs始终返回nil。该用户确实有有效好友,因为在使用Facebook SDK 15(非有限登录模式)时,通过GraphRequest请求me/friends能正常获取到数据,但在有限登录模式下执行GraphRequest会失败。官方文档显示有限登录支持获取好友列表,请问有没有人成功解决这个问题?

内容的提问来源于stack exchange,提问作者christophercotton

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 04:34:55