With the following code
NSURL *url = [NSURL fileURLWithPath: localFilePath];
NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL: url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
self.avAudioPlayer = [[AVAudioPlayer alloc] initWithData:data error: nil];
self.avAudioPlayer.volume = 0.5;
self.avAudioPlayer.delegate = self;
[self.avAudioPlayer play];
}];
[task resume];
Task never starts on iOS 6.x, but works fine with iOS 7.x, 8.x
Will be looking for another way of doing this, but curious by it is not work on iOS 6.
Simply because, as the official reference on
NSURLSessionTask
states, it's been introduced in iOS 7.0.