- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试根据附加到我从中提取 imageFile 的同一对象的 objectID 检索 PFFile 图像。所有其他细节都被正确拉取(字符串),但是,当我拉取 PFFile 时,会加载该类中的随机图像,通常不是该对象的匹配图像,下面是我如何查询它的代码,我不确定在哪里我的逻辑是错误的。
@objc(mapView:didTapMarker:) func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
if z == 0 {
print("\(marker) tapped")
let lat = marker.position.latitude as Double
let long = marker.position.longitude as Double
let tempMarker = getMarkerForLongAndLat(long: long, lat: lat, markers: markers)
let index = getIndexForMarker(marker: tempMarker)
getInfo(self.markersID[index]) {
PFFile in
self.imageFile?.getDataInBackground(block: { (imageData, error) in
if(imageData != nil) {
self.fullImage = UIImage(data: imageData!)
}
})
self.performSegue(withIdentifier: "playerSegue", sender: nil)
}
}
return true
}
func getInfo(_ markerID : String, completion: @escaping (PFFile) -> Void)
{
self.group.enter()
print("printing")
print(markerLat)
print(markerLong)
print(postsLat)
print(postsLong)
print("A")
let query = PFQuery(className:"Posted")
print("b")
print(markerID)
//query.whereKey("GPS", equalTo: PFGeoPoint(latitude: markerLat, longitude: markerLong))
query.whereKey("objectId", equalTo: "\(markerID)")
query.findObjectsInBackground { (objects, error) in
print("c")
if(error == nil)
{
print("d")
for object in objects!
{
print("made it")
self.imageFile = (object.object(forKey: "ImageFile") as! PFFile?)
self.userofVideo = object.object(forKey: "User") as AnyObject?
self.hour = object.object(forKey: "Hour") as AnyObject?
self.minutes = object.object(forKey: "minutes") as AnyObject?
self.streetName = object.object(forKey: "Location") as AnyObject?
self.tempLat = (object.object(forKey: "GPS")! as AnyObject).latitude as Double
self.tempLong = (object.object(forKey: "GPS")! as AnyObject).longitude as Double
self.currentText = (object.object(forKey: "text")! as Any? as! String?)
self.tempCoordinates = CLLocationCoordinate2D(latitude: self.tempLat! as CLLocationDegrees, longitude: self.tempLong! as CLLocationDegrees)
//print(tempLong)
}
}
else
{
print("didn't make it")
print(error)
}
completion(self.imageFile!)
}
self.group.leave()
}
最佳答案
在for
循环
内添加getDataInBackground
。这是您的代码的快速 swift 3 示例。
@IBOutlet weak var fullImage : UIImageView!
let imageFile = (object.object(forKey: "ImageFile") as? PFFile)
imageFile?.getDataInBackground (block: { (data, error) -> Void in
if error == nil {
if let imageData = data {
//Here you can cast it as a UIImage or do what you need to
self.fullImage.image = UIImage(data:imageData)
}
}
})
关于ios - 解析检索错误的 PFFile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41411848/
我得到了“从 PFFile 到 PFFile 的条件转换总是成功”的提示,它突出显示了 if let tempProductPicture = self.askProductImageArray[0]
从 Parse 检索图像并将其显示在 tableView 上,如果我向下滚动 tableView,应用程序崩溃并给出“ fatal error :数组索引超出范围” 行数由“messagesArray
我想从磁盘获取 PFFile。我在这里了解到 Parse 会在下载所有 PFFile 时对其进行缓存。我现在想知道如何检索该缓存。什么是正确的路径。我使用的路径建议here NSString *pat
我正在尝试根据附加到我从中提取 imageFile 的同一对象的 objectID 检索 PFFile 图像。所有其他细节都被正确拉取(字符串),但是,当我拉取 PFFile 时,会加载该类中的随机图
解析仪表板版本 1.1.2 解析服务器版本2.7.1 环境设置 在 Ubuntu 16.4( digital ocean Droplet)上运行的 Parse-Dashboard 重现步骤 添加新的文
是否可以在运行 Parse Server 的 mlab.com/heroku 中的一个字段名下保存一组图像。我试图在一个字段名称中保存 150 张图像。我知道如何保存一张图片。但是是否有可能在一个字段
我在使用我的 iOS 应用程序从我的数据库中上传的 PFFile 的 URL 流式传输视频时遇到问题。我使用了 Heroku 和 AWS,但我仍然遇到同样的问题。当文件托管在旧的解析服务器中时,它过去
Parse.com 刚刚更新了他们的 SDK 以支持本地存储。但是在安装新的 SDK 之后,PFFile 出现了一些问题。我已经使用相同的方法很长时间了,但是现在我使用的是新的 SDK,我无法让它工作
我正在使用 Parse,并且有一个名为“GolfScorecard”的类,该类有多个键,其中包括一个“scorecardImage”键,它是一个 PFFile。我正在尝试将所有高尔夫记分卡信息显示在
我有一个 UItextView,我可以在其中放置图像并输入文本,一旦完成 TextView,我就会将该 textView 的内容上传到 Parse。 如果我只向 textView 添加 1 个图像,它
我在我的 iOS 应用程序中使用核心数据实现了一个本地数据库,该数据库从由 Parse 驱动的后端填充。 我想要一个 Core Data 实体,它的属性是 PFFile(一个解析文件对象)。 Core
这是我加载图片的方式: func LoadImage(sender:FeedVC, cellId:Int){ self.currentlyLoading = true let quer
我上传了一个 PFFile 到 Parse.com,并保存了 PFFile 的 url。然后我删除了 PFFile,并尝试使用保存的 url 下载 PFFile。成功了! 所以我的问题是:Parse.
在我的聊天应用程序中,我对用户表使用 Parse,获取 ID、图像等。我最近添加了此功能,但遇到了一个问题。当我发送消息时,我创建了一个 NSDictionary,其中包含有关消息的信息,例如时间、消
我已经在这个问题上停留了很长一段时间,我阅读了很多线程,但没有一个描述了我的问题我尝试了一大堆不同的方法来解决这个问题,但没有一个奏效。我有一个从数组中提取并通过 segue 发送到下载详细信息 Vi
我正在尝试使用解析从指针获取图像。我正在尝试从类中提取图像而不发出第二个请求。 这是代码: PFFile * connectImageFile = [object objectForKey:@"pra
我想在一个 PFFile 中保存 2 个数据:一个图像和一个数据声音。这对于图像 (fileData) 来说是正确的,但我想在 Parse.com 中为数据声音 (fileData2) 添加一列。我怎
这是我的 NGINX 设置, HTTPS 服务器 server { listen 443 ssl spdy; location /myparseserver/ {
我正在为我的应用程序使用 Parse 和 MongoDB,但我有一个关于 PFFile 的问题。我想在服务器上保存一个空的 PFFile。事实上,用户不必发送图片,但可以通过其他方式发送。 我想设置一
基本上我正在努力解决这个问题:我安装了一个 FacebookAlbumPicker ( https://github.com/OceanLabs/FacebookImagePicker-iOS ) 现
我是一名优秀的程序员,十分优秀!