使用未声明的类型 FBRequest

Use of Undeclared type FBRequest

当我将下面的代码用于我的 swift 2 xcode 7 项目时,使用 parse 1.8.5 sdk,我在第一行收到错误 "use of undeclared type 'FBRequest' "。我下载了最后一个 facebook 和解析框架。为什么会出现此错误?

    let request:FBRequest = FBRequest.requestForMe()
                request.startWithCompletionHandler { (connection:FBRequestConnection!, result:AnyObject!, error:NSError!) -> Void in
                    if error == nil{
                        if let dict = result as? Dictionary<String, AnyObject>{
                            let name:String = dict["name"] as AnyObject? as String
                            let facebookID:String = dict["id"] as AnyObject? as String
                            let email:String = dict["email"] as AnyObject? as String

                            let pictureURL = "https://graph.facebook.com/\(facebookID)/picture?type=large&return_ssl_resources=1"

                            var URLRequest = NSURL(string: pictureURL)
                            var URLRequestNeeded = NSURLRequest(URL: URLRequest!)


                            NSURLConnection.sendAsynchronousRequest(URLRequestNeeded, queue: NSOperationQueue.mainQueue(), completionHandler: {(response: NSURLResponse!,data: NSData!, error: NSError!) -> Void in
                                if error == nil {
                                    var picture = PFFile(data: data)
                                    PFUser.currentUser().setObject(picture, forKey: "profilePicture")
                                    PFUser.currentUser().saveInBackground()
                                }
                                else {
                                    println("Error: \(error.localizedDescription)")
                                }
                            })
                            PFUser.currentUser().setValue(name, forKey: "username")
                            PFUser.currentUser().setValue(email, forKey: "email")
                            PFUser.currentUser().saveInBackground()
                        }
                    }

我正在使用以下框架:

  import FBSDKCoreKit

  import FBSDKLoginKit

  import FBSDKShareKit

  import ParseFacebookUtilsV4

Facebook iOS SDK 4.x 中没有 FBRequest。请改用 FBSDKGraphRequest。您可以阅读有关从 Facebook iOS SDK 3.x 迁移到 4.x here.

的更多信息