[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(outputDeviceChanged:) name:AVAudioSessionRouteChangeNotification object:[AVAudioSession sharedInstance]];
- (void)outputDeviceChanged:(NSNotification *)aNotification
{
NSLog(@"---%@", aNotification.userInfo);
// do your jobs here
}
{
AVAudioSessionRouteChangePreviousRouteKey = "<AVAudioSessionRouteDescription: 0x17420ded0, \ninputs = (null); \noutputs = (\n \"<AVAudioSessionPortDescription: 0x17420dbc0, type = Headphones; name = \\U8033\\U673a; UID = Wired Headphones; selectedDataSource = (null)>\"\n)>";
AVAudioSessionRouteChangeReasonKey = 8;
}