Reputation: 21
I have an xcode (4.3.2) project where I am trying to play audio. I have two iPad2 devices to test on. Both are running iOS 5.1 (9B176), though one is a 3G and one is not. The sound plays in the simulator and the none 3G iPad, but I can't get the audio to play on the 3G device.
Audio works on the programs I have on the device though. The method I have for playing sound is as follows
-(void) playSound {
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"gbm_menu_music"
ofType:@"m4a"];
NSURL *soundURL = [NSURL fileURLWithPath:filePath];
avPlayer = [[AVPlayer alloc] initWithURL:soundURL];
[avPlayer play];
}
Which I call from
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Any help is appreciated.
Upvotes: 0
Views: 737
Reputation: 21
It seems it was a problem specific to the device itself. On the iPad in Settings under General, under the heading "Use Side Switch to:", the device was set to "Lock Rotation". Changing it to "Mute" fixed the problem. Switching it back to "Lock Rotation" is fine too.
Answer found at: https://devforums.apple.com/message/610297#610297
Upvotes: 2