簡體   English   中英

解析/Swift getObjectInBackgroundWithId 查詢不起作用

[英]Parse/Swift getObjectInBackgroundWithId query not working

我正在嘗試運行查詢以獲取帶有 ID 的后台對象,但是當我運行方法query.getObjectInBackgroundWithId ,我收到錯誤消息:

"Cannot invoke 'getObjectInBackgroundWithId' with an argument list of type (string, block: (PFObject!,NSError?) -> Void"

當我使用user.signUpInBackgroundWithBlock時會發生同樣的事情,所以我想也許 Xcode 在使用“塊”時更新了一些功能,現在語法可能有所不同? 有任何想法嗎?

這是我的代碼片段:

http://imgur.com/1CvfhbU

是的!!! 謝謝!

getObject 的新示例代碼是:

query.getObjectInBackgroundWithId("Oaq79bhv53") {
        (gameScore: PFObject?, error: NSError?) -> Void in
        if error == nil && gameScore != nil {
            println(gameScore)
        } else {
            println("error")
        }
    }

我想到了!

user.signUpInBackgroundWithBlock{(succeeded: Bool, signUpError: NSError?) -> Void in

斯威夫特 4.2:

query.getObjectInBackground(withId: "YourId") { (gameScore, error) in
  if error == nil {
    // Success!
    print(gameScore)
  } else {
   // Fail!
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM