xcode4 "dyld: Symbol not found: _OBJC_CLASS_$_AVCaptureDevice" error
Asked Answered
B

4

6

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.

Bernardinebernardo answered 24/4, 2011 at 16:6 Comment(1)
We're getting this same issue. Have you found a solution? Our SDK is latest, Target is 4.0, cleaning and restarting Xcode 4 hasn't helped.Vestpocket
R
8

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.

Rivet answered 6/6, 2011 at 21:30 Comment(1)
I had same issue somewhat like this. I got message like "dyld: Symbol not found: _OBJC_CLASS_$_MPNowPlayingInfoCenter". The MPNowPlayingInfoCenter is available only after iOS 5.0 and I was running App on iOS 4.0. So I make MediaPlayer Framework optional and it worked for me. Thanks @Angus for the answer.Myatt
C
3

AVFoundation framework doesn't work in simulator. Only on devices.

Cyndie answered 1/7, 2011 at 6:50 Comment(0)
A
0

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.

Auckland answered 24/4, 2011 at 16:19 Comment(8)
Also, did you set SDK to latest and Deployment target to 4.0 in order to launch on different simulator versions? Make sure you don't change the SDK setting to anything different from Latest.Auckland
I am new to iPhone Development. So I might well be missing somethng ..For the question "maybe you link on Version level or something", I am not sure how I could do that. In the my project, "target", "build phases", "link Binary With Libraries", I do have AVFoundation.framework specified as required.Bernardinebernardo
for the deployment target, I have set it to 4.0. However, for "set SDK to latest", I am not sure how to set it for simulator. I am using xcode 4 and it looks like I am using 4.3 sdk by default. - thanks for your patience..Bernardinebernardo
ok. the skd is indeed "iOS SDK 4.3" :-) .. it shows up on the project entry on hte left bar.Bernardinebernardo
If everything looks correct try to restart Xcode. Xcode4 sometimes gives really funny behavior. Also, you could try to create a brand new empty project and just link against AVFoundation.. you could then see if it reproduces.Auckland
I came across this as well. Since the simulator doesn't have a camera you should weak-link the AVFoundation framework (see the dropdown on the right, change from 'Required' to 'Optional'.Tighten
I had the same problem. AVFoundation works only on device. Not in simulator. Make it optional.Falsify
@Falsify +1 Thank you, that worked. An FYI, this is the same as "weak" linking in Xcode 3. It is now called "optional" in Xcode 4.Flossie
L
0
  1. Rename file *.m -> *.mm
  2. Add Framework to Project (Proj -> Frameworks etc. -> +) AVFoundation.framowork contain sumbol AVCaptureDevice
  3. Clear Build -> Recompile

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

enter image description here

II. Open problem *.mm file -> AVCaptureDevice -> Right Click -> Jump to definition

enter image description here

Lummox answered 22/3, 2023 at 14:36 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.