Hello
In the app you can add a text and a photo to each line.
Now I want to delete the text and the photo in the line, which is clicked in the line.
@IBAction func remove(_ sender: Any) {
let query = PFQuery(className: "Post")
query.whereKey("username", equalTo: PFUser.current()?.username)
query.findObjectsInBackground(block: { (object, error) in
if let posts = object {
for post in posts{
print(posts)
self.comments.remove(at: self.comments.index(of: post["message"] as! String)!)
self.imageFile.remove(at: self.imageFile.index(of: post["imageFile"] as! PFFile)!)
self.tableView.reloadData()
}
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
})
}
Message in the line 13. Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
I'm still a beginner and I'm not going any further.
Can someone help me and show me how I need to do this delete function ?
thank you very much
best greetings