I am trying to play a video with AVPlayer
but I don't have the URL for it saved, I do have the NSData of the video saved in Core Data however. Is it possible to covert NSData
into a NSURL
? Or should I just save all the videos into say the documents folder and reference those.
Yes, you should save the videos in the documents directory, and save the names of the videos in Core Data. It's possible to save arbitrary binary data in Core Data but it's not always a good idea. It's especially not a good idea if the way you need to use that data requires a file URL. You could keep the videos in Core Data and work around it (e.g. by reading them from Core Data and saving them to a temporary location) but that's a lot slower and uglier than just putting them in files to begin with.