I am trying to implement system sound playback in my application running on iOS 10.3.1. The problem I am experiencing is that when I am in viewDidLoad, when the application is being debugged, the sound is played. When an application runs fine, it always vibrates.
AudioServicesPlayAlertSoundWithCompletion(1107, nil);
When I want to use the same system sound in a specific place in the application, the corresponding place that should play the sound, it does nothing, does not sound, and does not vibrate in debug mode or in a normal run.
I do not see any errors or warnings when starting the application. EDIT * Added code in which I use it:
- (void)viewDidLoad { [super viewDidLoad]; AudioServicesPlayAlertSoundWithCompletion(1107, nil);
It always vibrates, it doesn't matter if the call is on or the phone is connected to the X-code or not.
This is imported from me, if it means something:
#import <AVFoundation/AVFoundation.h> #import <CoreLocation/CoreLocation.h> #import "CoreLocationController.h" #import <AudioToolbox/AudioServices.h>
Anyone can help?
ios xcode
Borce Ivanovski
source share