By default, when you are streaming an audio, by exiting the app it will stop, but you can prevent this by turning on the first check box in Background capability page in Xcode.
iOS will automatically handle this for you, and you don't need to write any code!