Xcode 6.3.2 – 无法通过Parse.com – Swift从Facebook获得授权

从Xcode 6.2重build应用程序到6.3.2

parsing链接正在工作,用指导中的虚拟代码进行testing。

我认为问题是在授权请求中,必须改变Parse获取用户信息的方式,但不能解决问题。

更新提示1:如果我注册,没有问题,但如果我停止并重新打开应用程序,问题就在那里,因为saveInBackgroundWithBlock自动完成失败,那里可能有问题,但在哪里? 更新提示2:我在Parse的网站上看到,每次login时,“会话”都在不断增长

有这个错误:

在这里输入图像说明

我请求授权的代码:

import UIKit import Parse class LoginViewController: UIViewController, FBLoginViewDelegate { @IBOutlet weak var fbLoginView: FBLoginView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func pressedLoginFB(sender: UIButton) { //MARK: facebook personlized login from 440 //to start, request permissions PFFacebookUtils.logInWithPermissions(["public_profile", "user_about_me", "user_birthday"], block: { user, error in if user == nil { println("BAD! user cancelled login") //add a uialertcontrolelr before pushing to app store return } else if user!.isNew { println("GOOD! - User signed up with Facebook") //now, ask facebook for user's data FBRequestConnection.startWithGraphPath("/me?fields=picture,first_name,birthday", completionHandler: { connection, result, error in var resultDictionary = result as! NSDictionary user!["firstName"] = resultDictionary["first_name"] user!["gender"] = resultDictionary["gender"] var dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "dd/MM/YYYY" user!["birthday"] = dateFormatter.dateFromString(resultDictionary["birthday"] as! String) let pictureURL = ((resultDictionary["picture"] as! NSDictionary)["data"] as! NSDictionary) ["url"] as! String let url = NSURL(string: pictureURL) let request = NSURLRequest(URL: url!) //in old Xcode was an optional NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler: { response, data, error in let imageFile = PFFile(name: "avatar.jpg", data: data) user!["picture"] = imageFile as PFFile //MARK: not sure about this downcast user!.saveInBackgroundWithBlock({ success, error in println("hello") println(success) println(error) }) }) } ) } else { println("GOOD - User logged in with Facebook") } let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("mapNavVCID") as! UIViewController self.presentViewController(vc, animated: true, completion: nil) }) } } 

这是我的个人用户结构,用于解耦Parse:

 import Foundation import MapKit import Parse struct User { let id: String // let pictureUrl: String let name: String private let pfUser :PFUser //pfUser is private because I will use it only with our backend //this is a nested function, I use this design pattern because of getDataInBackgroundWithBlock func getPhoto(callback:(UIImage) -> ()) { let imageFile = pfUser.objectForKey("picture") as! PFFile imageFile.getDataInBackgroundWithBlock({ data, error in if let data = data{ callback(UIImage(data: data)!) } }) } } private func pfUserToUser(user: PFUser) -> User { return User(id: user.objectId!, name: user.objectForKey("firstName") as! String , pfUser: user) // I cut off this: // "pictureUrl: user.objectForKey("picture") as String," because now it is an image thanks to gePhoto function } //test on optionals "if user exists, give the value to the user constant, //and return a User instance via pfUserToUser function" // the "-> User?" is the reason why I have an optional in loginViewController on " currentUser()? " func currentUser() -> User? { if let user = PFUser.currentUser() { return pfUserToUser(user) } else { //if optional user doesn't exist, return nil return nil } } 

提前致谢