I have set up a connection to download this mp4 clip to my device and I'm using the following delegate function to store the data in a "streaming" type fashion.
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"BuckBunny.mp4"];
[data writeToFile:filePath atomically:YES];
}
However, when the 5.3MB file is finished downloading, I check the size of the saved file and it's only 1KB and consequently won't play. Am I just saving a small slice instead of the whole thing like I wanted? What do I need to do differently?