Ray
Ray

Reputation: 289

AVFoundation sound working on iOS 6 simulator but not device?

Help! I can play sound on the iOS simulator, but not my device! Here is my code (yes, the audio file is in the specified location, it definitely works:

SystemSoundID hashtag;

NSString *path  = [[NSBundle mainBundle] pathForResource:@"hashtag" ofType:@"wav"];

NSURL *pathURL = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) pathURL, &hashtag);
AudioServicesPlaySystemSound(hashtag);

Upvotes: 4

Views: 512

Answers (1)

AustinRathe
AustinRathe

Reputation: 681

Two suggestions, and I have had the same problem caused by both!

1) The ios device is case sensitive when it comes to file names whilst the simulator is not. 2) Is your device muted? This sound stupid, but it is the number one cause of bug reports on an app I use AVFoundation in!

Upvotes: 1

Related Questions