This article describes how to trigger when headphones are plugged/ unplugged.
These steps should be implemented on the application side.
NSNotificationCenter *nc [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(routeChanged:) name:AVAudioSessionRouteChangeNotification object:nil];
This code was taken from:
Responding to Audio Hardware Route Changes.
Use the KPController instance under ‘KPViewController’ to control your playback.