xcode4“dyld:找不到符号:_OBJC_CLASS_$_AVCaptureDevice”错误
我的 iPhone 应用程序在 IOS 4.3 模拟器中运行,但不在任何其他 IOS 4.0+ 模拟器中运行。尽管如此,它还是会在那里运行。
我收到以下错误 -
GNU gdb 6.3.50-20050815(Apple 版本 gdb-1518)(UTC 2011 年 2 月 12 日星期六 02:52:12) 版权所有 2004 自由软件基金会,Inc. GDB 是免费软件,受 GNU 通用公共许可证保护,您可以 欢迎在某些条件下对其进行更改和/或分发其副本。 输入“显示复制”以查看条件。 GDB 绝对没有任何保证。输入“显示保修”以了解详细信息。 该 GDB 被配置为“x86_64-apple-darwin”。附加到进程 71564。 dyld:找不到符号:_OBJC_CLASS_$_AVCaptureDevice 引用自:/Users/qianfan/Library/Application Support/iPhone Simulator/4.2/Applications/XXXX-XXXX/XXXX.app/XXXX 预计位于:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/AVFoundation.framework/AVFoundation 在/Users/qianfan/Library/Application Support/iPhone Simulator/4.2/Applications/XXXX-XXXX/XXXX.app/XXXX 共享库应用加载规则全部 (gdb)
我的应用程序正在使用(静态引用)最新的 ZXing iphone 代码(截至 2011 年 3 月 31 日和 2001 年 4 月 24 日测试了两个版本)。
我相信 AVCaptureDevice 存在于所有 iOS 4.0 + 中,并且 zxing 支持 ios 4.0 +。 当我这样做时:
Macintosh:zxing-trunk XXX$ grep _OBJC_CLASS_$_AVCaptureDevice /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/AVFoundation.framework/* 二进制文件 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/AVFoundation.framework/AVFoundation 匹配
什么建议吗?我要在这里寻找什么?太感谢了。
my iphone app runs in IOS 4.3 simulator but not any other IOS 4.0+ simulator. Even though, it shall run there.
I got the following errors -
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 71564.
dyld: Symbol not found: _OBJC_CLASS_$_AVCaptureDevice
Referenced from: /Users/qianfan/Library/Application Support/iPhone Simulator/4.2/Applications/XXXX-XXXX/XXXX.app/XXXX
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/AVFoundation.framework/AVFoundation
in /Users/qianfan/Library/Application Support/iPhone Simulator/4.2/Applications/XXXX-XXXX/XXXX.app/XXXX
sharedlibrary apply-load-rules all
(gdb)
My app is using (statically referencing) latest ZXing iphone code (two versions tested as of 2011-03-31 2001-04-24).
I believe AVCaptureDevice is existing in all iOS 4.0 + AND zxing is supporting ios 4.0 +.
when I do:
Macintosh:zxing-trunk XXX$ grep _OBJC_CLASS_$_AVCaptureDevice /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/AVFoundation.framework/*
Binary file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/AVFoundation.framework/AVFoundation matches
Any suggestions? what I shall look for here? Thank you so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我只想提一下 mmilo 的答案(关于将“必需”更改为“可选”)为我解决了问题。只需单击 AVFoundation.framework(在项目视图中的 Frameworks 文件夹下),然后确保最右侧的视图窗口已打开。您可以在此处将“目标成员资格”从必需切换为可选。
我的具体问题与梅尔文的相同。使用 4.3 SDK 时,我无法在 4.2 模拟器上编译我的项目,因为它找不到 AVCaptureDevice 类。
I just want to mention that mmilo's answer (about changing the 'Required' to 'Optional') solved the problem for me. Simply click on the AVFoundation.framework (under the Frameworks folder in the Project view) and then make sure the Right most view window is open. That's where you can switch the "Target Membership" from Required to Optional.
My specific issue was the same as melvin's. I couldn't get my project to compile on the 4.2 simulator when using the 4.3 SDK because it couldn't find the AVCaptureDevice class.
AVFoundation 框架在模拟器中不起作用。仅在设备上。
AVFoundation framework doesn't work in simulator. Only on devices.
我的案例的解决方案:
Xcode ->目标
常规
->构建设置
->在Mac Catalyst 部署
部分下,将支持 mac Catalyst
设置为是
。构建阶段
选项卡 ->向下滚动到将二进制文件与库链接
部分 ->添加 AVKit.framework ->清理构建文件夹并重建。A solution for my case:
Xcode -> target
General
->Build settings
-> underMac catalyst deployment
section, setSupport mac catalyst
toYes
.Build phases
tab -> scroll down to sectionLink binary with libraries
-> addAVKit.framework
-> clean build folder and rebuild.看起来您的项目没有与 AVFoundation 链接。也许您在版本级别或其他级别链接?这可以解释为什么它建立在其中一个而不是其他的基础上。
It looks like your project is not being linked against AVFoundation.. maybe you link on Version level or something? That would explain why it builds on one but not the others.
对项目中的其他问题 sumbol 重复步骤 2。检查所需的框架以包含到项目中,您可以通过多种方式找到:
例如,您的问题类/方法名称:“OBJC_CLASS$_AVCaptureDevice”类 AVCaptureDevice 包含在 AVFoundation
I 中。复制摘要名称 AVCaptureDevice -> Apple 开发者文档
II.打开问题*.mm文件-> AVCaptureDevice->右键单击->跳转到定义
Repeat step 2 for other problem sumbol in project. Check needed Framework for include to proj you can found by several way:
Example your problem class/method name: "OBJC_CLASS$_AVCaptureDevice" class AVCaptureDevice contain in AVFoundation
I. Copy sumbol name AVCaptureDevice -> Apple Developer documentation
II. Open problem *.mm file -> AVCaptureDevice -> Right Click -> Jump to definition