iOS Question How to have audible feedback on a button press?

karld

Active Member
Licensed User
Longtime User
I have been porting over my b4a app to b4i.
I have the user interface all converted and most of the logic.

What is stumping me at this point is how to have an audible click when a button is pressed. I have a custom keyboard for entering error codes and it would be nice to have audible feedback on key presses.
 
This worked great in development mode.
When I try to compile to release mode for testing it fails.
When I comment out the code for the audio it compiles .
 
Upvote 0
Hi,
try this code, I have added the framework import:
Code: Copy
Sub PlayNotification (id As Int)
   Dim no As NativeObject = Me
   no.RunMethod("playNotification:", Array(id))
End Sub
#if objc
#import <AudioToolbox/AudioToolbox.h>
- (void)playNotification:(int)soundId {
   AudioServicesPlaySystemSound(soundId);
}
#end if

Jan
 
Upvote 0
Hi,
try this code, I have added the framework import:
Code: Copy
Sub PlayNotification (id As Int)
   Dim no As NativeObject = Me
   no.RunMethod("playNotification:", Array(id))
End Sub
#if objc
#import <AudioToolbox/AudioToolbox.h>
- (void)playNotification:(int)soundId {
   AudioServicesPlaySystemSound(soundId);
}
#end if

Jan


This worked perfectly!
Thanks.
 
Upvote 0
Back
Top