Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何将图像从parse加载到UIImage到UITableViewCell中_Ios_Swift_Parse Platform_Uiimageview - Fatal编程技术网

Ios 如何将图像从parse加载到UIImage到UITableViewCell中

Ios 如何将图像从parse加载到UIImage到UITableViewCell中,ios,swift,parse-platform,uiimageview,Ios,Swift,Parse Platform,Uiimageview,我无法从解析加载图像。拇指称为“问题”没关系,但当我尝试从解析加载图像时,出现错误,应用程序崩溃 看一看: import UIKit class TableViewController: PFQueryTableViewController { // Initialise the PFQueryTable tableview override init(style: UITableViewStyle, className: String!) { super.init

我无法从解析加载图像。拇指称为“问题”没关系,但当我尝试从解析加载图像时,出现错误,应用程序崩溃

看一看:

import UIKit
class TableViewController: PFQueryTableViewController {

// Initialise the PFQueryTable tableview

    override init(style: UITableViewStyle, className: String!) {

        super.init(style: style, className: className)

    }

    required init!(coder aDecoder: NSCoder) {

        super.init(coder: aDecoder)

// Configure the PFQueryTableView

self.parseClassName = "Saude"

        self.textKey = "Nome"

self.pullToRefreshEnabled = true

self.paginationEnabled = false

    }

//    Define the query that will provide the data for the table view

    override func queryForTable() -> PFQuery {

        let query = PFQuery(className: "Saude")

        query.orderByAscending("Nome")

        return query

    }



    override func viewDidLoad() {

        super.viewDidLoad()



// Do any additional setup after loading the view.

    }



    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell? {

var cell = tableView.dequeueReusableCellWithIdentifier("CustomCell") as! CustomTableViewCell!

        if cell == nil

        {

            cell = CustomTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "CustomCell")

        }

        if let nome = object?["Nome"] as? String

        {

            cell.customNome.text = nome

        }

        if let categoria = object?["Categoria"] as? String

        {

            cell.customCategoria.text = categoria

        }

        let initialThumbnail = UIImage(named: "question")

        cell.customImage.image = initialThumbnail

        if let thumbnail = object?["imageFile"] as? PFFile

        {

            cell.customImage.file = thumbnail

            cell.customImage.loadInBackground()

        }

     return cell

    }





// In a storyboard-based application, you will often want to do a little preparation before navigation

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

// Get the new view controller using [segue destinationViewController].

//*let detailScene = segue.destinationViewController as! DetailViewController

let detailScene : DetailViewController = segue.destinationViewControlleras! DetailViewController

// Pass the selected object to the destination view controller.

iflet indexPath = self.tableView.indexPathForSelectedRow {

            let row = Int(indexPath.row)

            detailScene.currentObject = (objects?[row] as! PFObject)

        }

    }

    override func viewDidAppear(animated: Bool) {

// Refresh the table to ensure any data changes are displayed

        tableView.reloadData()

    }

}
错误:

2015-10-23 11:12:25.457 GuiaMogiNav[958:306603] -[UIImageView setFile:]: unrecognized selector sent to instance 0x176ce9a0

2015-10-23 11:12:25.459 GuiaMogiNav[958:306603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setFile:]: unrecognized selector sent to instance 0x176ce9a0'

*** First throw call stack:

(0x243bd85b 0x35d32dff 0x243c3025 0x243c0c7f 0x242f01a8 0xf13fc 0xf1810 0x189017 0x28830d63 0x28830e89 0x28820df5 0x2883546f 0x285db5af 0x284edcc3 0x27db5b05 0x27db1201 0x27db1091 0x27db05b1 0x27db0263 0x27da9a1f 0x24380091 0x2437e387 0x2437e7c5 0x242d10d9 0x242d0ecd 0x2d646af9 0x2855a2dd 0xe435c 0x36480873)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb) 

cell.customImage是PFImageView吗

UIImageView没有属性文件,但PFImageView有它,您应该使用它来加载解析图像


如果您使用的是故事板,则需要在identity inspector中将customImage对象的类更改为PFImageView

请仅显示与您的问题相关的部分。为了帮助你,我不知道问题出在哪里。我正在尝试将图片加载到tableview中的图像中。但当我尝试从解析中执行此操作时,它不起作用。图像只是不从解析加载。(对不起,我的英语不好。我是巴西人,我的英语不是葡萄牙语。好的,我正在检查你的代码