Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iOS - Attempting to play mp3 file fails
- - (IBAction)play:(UIButton *)sender {
- dispatch_queue_t downloadQueue = dispatch_queue_create("audio data downloader", NULL);
- dispatch_async(downloadQueue, ^{
- NSURL *audioURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/%@.mp3", FONYK_FILES_URL, [self.voicenote valueForKeyPath:@"Fonyker.fonykid"], [self.voicenote valueForKeyPath:@"Voicenote.vnid"]]];
- NSData *audioData = [NSData dataWithContentsOfURL:audioURL];
- dispatch_async(dispatch_get_main_queue(), ^{
- NSError *error = nil;
- AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithData:audioData error:&error];
- NSLog(@"%@", error);
- audioPlayer.delegate = self;
- [audioPlayer play];
- });
- });
- }
- Catchpoint 2 (exception thrown).Single stepping until exit from function __cxa_throw, which has no line number information.
- Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)"
- Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
- Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
- Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
- in /System/Library/Frameworks/Security.framework/Versions/A/Security
- 2012-04-17 15:03:43.054 Fonyk[8238:15307] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
- Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
- Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
- in /System/Library/Frameworks/Security.framework/Versions/A/Security
- NSURL *fileURL = [NSURL URLWithString:filePath];
- NSURL *fileURL = [NSURL fileURLWithPath:filePath];
- AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithData:[NSData dataWithContentsOfURL:audioURL] error:&error];
- - (IBAction)play:(UIButton *)sender {
- dispatch_queue_t downloadQueue = dispatch_queue_create("audio data downloader", NULL);
- dispatch_async(downloadQueue, ^{
- NSURL *audioURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/%@.mp3", FONYK_FILES_URL, [self.voicenote valueForKeyPath:@"Fonyker.fonykid"], [self.voicenote valueForKeyPath:@"Voicenote.vnid"]]];
- NSData *audioData = [NSData dataWithContentsOfURL:audioURL];
- dispatch_async(dispatch_get_main_queue(), ^{
- NSError *error = nil;
- AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithData:audioData error:&error];
- NSLog(@"%@", error);
- audioPlayer.delegate = self;
- [audioPlayer play];
- });
- });
- }
- NSURL *audioURL = [NSURL URLWithString:@"MY_MP3_URL"];
- MPMoviePlayerController* player = [[MPMoviePlayerController alloc] initWithContentURL:audioURL];
- [player play];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement