所以我是使用 Parse 的新手,并且在通过后端发布消息时遇到了一些问题。我可以设置一个用户帐户,但是当我尝试提交帖子时,我收到一条错误消息,上面写着...“致命错误:在展开可选值时意外发现 nil”...?
这是我的代码:
class ComposeViewController: UIViewController {
@IBOutlet var travelTextView: UITextView!
@IBOutlet var charRemainingLabel: UILabel!
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 sendPost(sender: AnyObject) {
var travelPost:PFObject = PFObject(className: "travelposts")
travelPost["content"] = travelTextView.text
travelPost["poster"] = PFUser.currentUser()
travelPost.saveInBackgroundWithTarget(nil, selector: nil)
self.navigationController?.popToRootViewControllerAnimated(true)
}