【问题标题】:PFFile parse into SWIFTPFFile 解析成 SWIFT
【发布时间】:2014-07-16 17:46:18
【问题描述】:

我正在 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
                }

            }

【问题讨论】:

    标签: objective-c parsing swift ios8 xcode6


    【解决方案1】:

    你需要在这个函数中调用 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
    }
    

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

    【讨论】:

    • 请贴出完整的视图控制器代码,我会为您编辑它以使其更清晰...
    猜你喜欢
    • 2015-12-29
    • 2017-04-03
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多