saner
saner

Reputation: 821

Use of Undeclared type FBRequest

When I use the code below for my swift 2 xcode 7 project using parse 1.8.5 sdk, I get the error "use of undeclared type 'FBRequest' " in the first line. I downloaded the last facebook and parse frameworks. Why am I getting this error?

    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()
                        }
                    }

I am using the frameworks below:

  import FBSDKCoreKit

  import FBSDKLoginKit

  import FBSDKShareKit

  import ParseFacebookUtilsV4

Upvotes: 2

Views: 1406

Answers (1)

mixel
mixel

Reputation: 25856

There is no FBRequest in Facebook iOS SDK 4.x. Use FBSDKGraphRequest instead. You can read more about migration from Facebook iOS SDK 3.x to 4.x here.

Upvotes: 3

Related Questions