Ios 更新后,我得到了一些错误

Ios 更新后,我得到了一些错误,ios,xcode,swift,facebook-graph-api,Ios,Xcode,Swift,Facebook Graph Api,我更新到了xcode 7.3,但是我得到了大量的错误。主要的一个是facebook sdk。下面是我的代码。我得到的错误是“下标”的用法不明确 userDetails.startWithCompletionHandler{(connection, result, error: NSError!)-> Void in if(error != nil){ print(error.localizedDescription) retu

我更新到了xcode 7.3,但是我得到了大量的错误。主要的一个是facebook sdk。下面是我的代码。我得到的错误是“下标”的用法不明确

userDetails.startWithCompletionHandler{(connection, result, error: NSError!)-> Void in
        if(error != nil){
            print(error.localizedDescription)
            return
        }

        if(result != nil){
            //error is for every line below userId-userBirthday
            let userId: String = result["id"] as! String
            let userFirstName: String? = result["first_name"] as? String
            let userLastName: String? = result["last_name"] as? String
            let userEmail: String? = result["email"] as? String
            let userBirthday: String? = result["birthday"] as? String

     }
}

使用最新的FBSDK,completionHandler:已更改

让我们看一下如下:

让graphRequest=FBSDKGraphRequest(graphPath:“me”,参数:param)

graphRequest.startWithCompletionHandler{[弱自]连接,结果, 错误

 if error != nil {

      //onError()

      print(error.description)

      return

 }else{

      let fbResult = result as! Dictionary<String, AnyObject>
      //Do You rest of the code here
 }
如果出错!=nil{
//onError()
打印(错误。说明)
回来
}否则{
让fbResult=结果为!字典
//你知道这里的其余代码吗
}

})

这是因为Xcode不知道结果是NSDictionary,请尝试以下方法:

let dic:NSDictionary = result

if(dic != nil){
        let userId: String = dic["id"] as! String
}

你应该知道哪一行给了你错误。我有我指出我得到了userId userbirth实例化的行,它被注释掉了没有注意到注释,抱歉。