[[UIDevice currentDevice] setProximityMonitoringEnabled:YES];
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
//默认情况下扬声器播放
[audioSession setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
[audioSession setActive:YES error:nil];
原文:http://www.cnblogs.com/liaolijun/p/6898473.html