0

当我尝试从我的 Parse.com 帐户中提取我的 NewsPages 类的内容子类时,应用程序崩溃并且日志给了我 : EXC_BAD_INSTRUCTION (code =EXC_1386,INVOP,subcode=0x0) error

请帮我解决这个问题。

这是代码:

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var teamNewsTextView: UITextView!

    override func viewDidLoad() {



        var query = PFQuery(className:"NewsPages")
        query.getObjectInBackgroundWithId("KerL5Xf0Bx") {
            (NewsPages: PFObject!, error: NSError!) -> Void in
            if error == nil {
                let content = NewsPages["content"] as String

                self.teamNewsTextView.text = content

            } else {
                NSLog("%@", error)
            }
        }



}}
4

1 回答 1

-1

尝试这个

 if error == nil {

if let content = NewsPages["content"] as? String
{
  self.teamNewsTextView.text = content

}
} 
else {
    NSLog("%@", error)
}
于 2014-12-22T07:41:55.220 回答