OK, so I managed to do this using some tricks:
First of all, here is the function that helps me set up the audio player:
func setupAudioPlayerWithFile(file:NSString, type:NSString) -> AVAudioPlayer? { //1 let path = NSBundle.mainBundle().pathForResource(file as String, ofType: type as String) let url = NSURL.fileURLWithPath(path!) //2 var audioPlayer:AVAudioPlayer? // 3 do { try audioPlayer = AVAudioPlayer(contentsOfURL: url) } catch { NSLog("Player not available") } return audioPlayer }
then when the user clicks the “trigger alarm” button, I do this:
silence_audio = setupAudioPlayerWithFile("silence", type:"wav"); silence_audio?.numberOfLoops = -1; silence_audio?.volume = 1; silence_audio?.play();
as you can guess, this sound is nothing - an empty sound. Apple said:
For tasks that require longer execution time for implementation, you must request specific permissions to run them in the background without pausing them. On iOS, only certain types of applications are allowed to run in the background:
-Apps that play audio content to the user in the background, for example, an application for a music player
An application that plays or records audio continuously (even while the application is running in the background) can register to perform these tasks in the background. You enable sound support from the Backgrounds section of the Features tab in your Xcode project. (You can also enable this support by including a UIBackgroundModes key with an audio value in your application Info.plist file.)
And I also had to do this: 
After that, my application can run in the background without restrictions. If Apple does not allow me to publish it, I will start using a microphone or something like that. Without this functionality, it is impossible to make an alarm application.
And too large a device’s volume is very simple:
let volumeView = MPVolumeView() if let view = volumeView.subviews.first as? UISlider{ view.value = 0.3 }
and you set the form view.value 0 - 1.
Hope this helps :)