iOS Code Snippet Play Beep Sound

Discussion in 'iOS Code Snippets' started by aeric, Oct 24, 2018.

Tags:
  1. aeric

    aeric Active Member Licensed User

    Code:
    Sub PlayBeep
        
    Dim NativeMe As NativeObject = Me
        NativeMe.RunMethod(
    "beep"Null)
    End Sub

    #If ObjC
    #import <AVFoundation/AVAudioPlayer.h>
    - (void) beep {
      AudioServicesPlaySystemSound(1302);
    }
    #End If
    You can change the value of 1302 above to other sound ID.

    List of SystemSoundIDs
    https://github.com/TUNER88/iOSSystemSoundsLibrary
     
  2. highflyer

    highflyer Member Licensed User


    Trying to compile using the remote build server the following error is generated:

    Error: ** BUILD FAILED **
    The following build commands failed:
    CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.o B4iProject/b4i_main.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    (1 failure)
     
  3. aeric

    aeric Active Member Licensed User

    How about debug mode?
     
  4. highflyer

    highflyer Member Licensed User

    The error message was generated while trying to compile in debug mode....
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Add a reference to the iMedia library. You can also add this line to remove the "library not used" warning:
    Code:
    #IgnoreWarnings: 32
     
    aeric likes this.
  6. highflyer

    highflyer Member Licensed User

    That solved the problem...thank you Erel
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice