I am converting individual images into UIImagePNGRepresentation but I keep getting a thread breakpoin ate let data = UIImagePNGRepresentation(tile as! UIImage)! ImageNameList is an nsmutablearray of images
var imageNameList: [String] {
var imageNameList2:[String] = [] //[NSMutableArray]()
for i in 0...149 {
let imageName = String(format: "pic_%03d", Int(i))
imageNameList2.append(imageName)
}
return imageNameList2
}
let table = PFObject(className: "Cool")
let tilesPF = imageNameList.map({ tile in
let data = UIImagePNGRepresentation(tile)! //cannot convert type string to type uiimage
let file = PFFile(data: data)
let tile = PFObject(className: "RealCool")
tile["tile"] = file
})
UIImageis not a subclass ofPFObject, so the casttile as! UIImagecan never be successful. The Swift compiler should already be giving you a warning: “Cast from 'PFObject' to unrelated type 'UIImage' always fails”.