spacebiker
spacebiker

Reputation: 3875

Simple Torch Application in XCode

I am trying to build a simple torch application for iOS 5 as described in http://developer.apple.com/library/mac/releasenotes/AudioVideo/RN-AVFoundation/_index.html#//apple_ref/doc/uid/TP40010717-CH1-DontLinkElementID_17 but i am getting "Apple Match-O Linker Error:

    Undefined symbols for architecture armv7:
  "_AVMediaTypeVideo", referenced from:
      -[FirstViewController viewDidLoad] in FirstViewController.o
  "_OBJC_CLASS_$_AVCaptureDevice", referenced from:
      objc-class-ref in FirstViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help appreciated


Anybody ?

Additionally: it only happens when running the project, no errors if i just clean & Build, and the code completion detects the library.

Thanks

Upvotes: 2

Views: 2588

Answers (2)

spacebiker
spacebiker

Reputation: 3875

As simple as this:

Linker errors like this indicate that a symbol is missing when the app is being linked. Most system symbols like these, come from system frameworks. So, I was missing a framework in my project that contains AVCaptureDevice and AVMediaTypeVideo.

To solve it, i just added the AVFoundation framework following this tutorial: http://www.thinketg.com/Company/Blogs/11-03-20/Xcode_4_Tips_Adding_frameworks_to_your_project.aspx

Now it runs !

Upvotes: 0

Randall
Randall

Reputation: 14849

You might need to link your project with the AVFoundation framework first. If you're already doing that, make sure you're building for armv7 and not just armv6. Check it in your project settings > Target > Build Settings > Architecture

Upvotes: 5

Related Questions