2015-09-25 93 views
0

試圖從解析中獲取圖像並設置它的uiimage,但不斷收到此錯誤。運行Xcode中7,快捷的2.0Swift從Parse.com中獲取圖像並使用它設置圖像

不能援引 'getDataInBackgroundWithBlock' 類型的參數列表 '(爲imageData:NSData的,錯誤:NSError.Type,() - >())'

let query: PFQuery = PFQuery(className: "Items") 
    query.whereKey("ItemOwner", equalTo: "Shreddish") 

    // 3 
    query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in 
     if error == nil { 
      print("Successfully retrieved: \(objects)") 
      for object in objects! { 
       print(object) 
       let imageFile: PFFile = object["ItemMainImage"] as! PFFile 
       var image = imageFile.getData() 

       imageFile.getDataInBackgroundWithBlock(imageData: NSData, error: NSError) { 


       } 
      } 
     } else { 
      print("Error: \(error) \(error!.userInfo)") 
     } 
    } 
+1

什麼'findObjectsInBackgroundWithBlock'的簽名? – NobodyNada

+0

@NobodyNada聽起來像一個函數,需要一個閉包 –

+0

是啊我試着跟着一些其他的示例代碼,但它沒有工作,@ NobodyNada只是想通了,我匹配findObjectsInBackground的簽名,它的工作 – shreddish

回答

1

變化

imageFile.getDataInBackgroundWithBlock(imageData: NSData, error: NSError) { 
    ... 
} 

imageFile.getDataInBackgroundWithBlock { 
    (imageData: NSData?, error: NSError?) -> Void in 
    ... 
} 
相關問題