gpt4 book ai didi

objective-c - PFFile 解析为 SWIFT

转载 作者:行者123 更新时间:2023-11-28 09:20:45 25 4
gpt4 key购买 nike

正在 xCode 6-Beta3 中构建应用程序。当我运行该应用程序时,它崩溃了。

但是,如果我//Comment//在应用程序启动下方的这段代码中。注释掉代码的图像将在新用户注册时加载到 Parse 库,因为表已创建。也可以从 Parse 查看和下载它们。所以他们在发帖

但应用程序仍然无法预览图像。感谢任何专家的帮助。谢谢

这是运行时的错误:Thread 1 EXC_BAD INSTRUCTION (code=EXC_I138_IVNPO, subcode=0x0

//导致应用崩溃的配置文件图像代码//

            cell.profileImageView.alpha = 0

let profileImage:PFFile = user["profileImage"] as PFFile

profileImage.getDataInBackgroundWithBlock{
(imageData:NSData!, error:NSError!)->Void in

if !error{
let image:UIImage = UIImage(data: imageData)
cell.profileImageView.image = image
}

}

最佳答案

你需要在这个函数中调用 cell.profileImageView.image = image

override func tableView(tableView: UITableView, cellForRowAtIndexPath         indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as YourCustomCellClass



// Configure the cell...

return cell
}

还要确保在 Storyboard上将单元格的重用标识符设置为“单元格”

关于objective-c - PFFile 解析为 SWIFT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24787382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com