gpt4 book ai didi

iphone - 调用AudioServicesPlaySystemSound时出现2个错误?

转载 作者:行者123 更新时间:2023-12-03 19:02:39 24 4
gpt4 key购买 nike

我正在制作一个应用程序,一旦计时器达到一定限制,它就会振动。

但是,当调用时

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Xcode 出现两个错误:

Undefined symbols for architecture i386:
"_AudioServicesPlaySystemSound", referenced from:
-[drawGraph drawRect:] in drawGraph.o
ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

关于导致这些错误的原因有什么想法吗?

最佳答案

enter image description here

如果您根本不能仅添加头文件(如上所示),则必须将框架添加到您的项目中。你应该有一个以下标题。 #import <AudioToolbox/AudioToolbox.h>

  1. In Xcode, click your project file at the top of the Project Navigator.

  2. Click 'YourProjectName' under "Targets"

  3. Click the "Build Phases" tab.

  4. Click the plus in the "Link Binary With Libraries" window.

  5. Add the AudioToolbox.Framework library

  6. Add #import <AudioToolbox/AudioToolbox.h>

enter image description here

关于iphone - 调用AudioServicesPlaySystemSound时出现2个错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11919923/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com