Simple way to play a sound file (.aif)

后端 未结 4 1315
猫巷女王i
猫巷女王i 2021-02-02 17:45

I\'m making an app for Mac OS X using Xcode, and I want it to play a alert sound when something happens.

What is the simplest code for playing a sound in Objective-C/Coc

4条回答
  •  长情又很酷
    2021-02-02 18:29

    You can copy and add your .aif files to your project in Xcode as follows:

    1. Command-click on the Classes folder (from within xCode)
    2. Select Add > Existing Files
    3. Navigate to the directory containing your .aif and select it(them). Click Add. (optional: Check the “Copy items” checkbox & Click Add.)

    See Apple's examples & great info: here & here.

提交回复
热议问题