In the MainController.h file change the following:
#import "MainViewController.h"
#import <AVFoundation/AVFoundation.h>
@implementation MainViewController
- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
}
return self;
}
I'm not sure if the following is necessary but I cleaned my project (CMD+ALT+K), recompiled the PhoneGap / Cordova Lib (change target and let it run to simulator) and (after changing the target again) compiled to the application once more and now it works!
Beware: it only works on Device, not on the simulator