Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Saving Data on a Server with Swift 2 Decoupling the Data Playing a Memo

Error retrieving file.

Pasan-

First off, great tutorials - I've converted from Obj-C to Swift almost purely on your videos. For this tutorial, I can't get it to work. The memo will not retrieve from CloudKit. I've attached the code snippets below:

extension ViewController: UITableViewDelegate {
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let memo = dataSource.objectAtIndexPath(indexPath: indexPath)

        let track = memo.track
        print("Track: \(track?.description)")

        guard let trackData = memo.track else {
            print("Something is wrong")
            return
        }
        player.play(track: trackData)
    }
}


var track: Data? {
        do {
            return try Data(contentsOf: fileURL)
        }  catch let error {
            print("Error retrieving track: \(error.localizedDescription)")
        }
        return nil
}

Each time I try to select a saved memo from the TableView, I get the same errors:

Error retrieving track: The file “3296316E-6F4C-43EF-8C24-E898A3470A37.016cb5e746229522ad2cb504bd1c34e897133d205a” couldn’t be opened because there is no such file.

Track: nil

Error retrieving track: The file “3296316E-6F4C-43EF-8C24-E898A3470A37.016cb5e746229522ad2cb504bd1c34e897133d205a” couldn’t be opened because there is no such file.

Something is wrong

PLEASE HELP!

Thanks :)

Clayton