【发布时间】:2015-09-04 01:31:15
【问题描述】:
我想知道我是否在这里做错了什么。
我有一个PFUser 的子类,它的属性为profileImage,即PFFile
在某些情况下,我不会立即将 profileImage 保存到 Parse,而仅将其固定到 localDatastore。
但是当我尝试从localDataStore 取回它并使用getDataInBackgroundWithBlock 时。它不会返回任何错误,但是回调返回的 NSData总是 nil。
if let profileImage = PGUser.currentUser()?.profileImage {
profileImage.getDataInBackgroundWithBlock { (data: NSData?, error: NSError?) -> Void in
if error == nil {
if data != nil {
println("IMAGE DATA FOUND")
let image = UIImage(data: data!);
self.profileImageView.image = image;
}
else {
//DATA IS ALWAYS NIL
println("NO IMAGE DATA FOUND")
}
}
}
}
-
PGUser.currentUser()?.profileImage不为零 -
getDataInBackgroundWithBlock函数没有返回错误。 - 但是 数据 总是 无。
对我做错了什么有什么想法吗?
谢谢!!
【问题讨论】:
-
error告诉你什么? -
问题是数据总是nil。 getDataInBackgroundWithBlock 中的数据。这可能是什么原因造成的?
-
我不知道,也许
error参数可以说明情况 -
错误为零。但数据也是零
-
记录文件URL,看看你是否可以在浏览器中访问它。上传时有错误吗?
标签: ios parse-platform uiimage pfobject pffile