I am trying to implement playing of system sound in my app running on iOS 10.3.1 The problem i am experiencing is that when i am in viewDidLoad, when the app is being debugged, the sound is being played. When the app is running normally, it is always vibrating.
AudioServicesPlayAlertSoundWithCompletion(1107, nil);
When i want to use this same system sound, in a specific location in the app, the appropriate location which should produce sound, it doesn't do anything, no sound nor vibrate in debugging mode or normal run.
I don't see any errors nor warning when the app is running. EDIT* Added some code where i use it:
- (void)viewDidLoad
{
[super viewDidLoad];
AudioServicesPlayAlertSoundWithCompletion(1107, nil);
//AudioServicesPlayAlertSoundWithCompletion(1100, nil); (same)
}
This always does only vibrate, doesn't matter if turned on the ringer, or whether it is connected the phone to Xcode or not.
I have this imported, if it means anything:
#import <AVFoundation/AVFoundation.h>
#import <CoreLocation/CoreLocation.h>
#import "CoreLocationController.h"
#import <AudioToolbox/AudioServices.h>
Anyone can help?