Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode - Add AVFountation Framework

I'm creating an iphone app using xcode 4.2, and trying to use the AVFoundation Framework to play some radio stream.
When i import it to the project's frameworks and the build, i get the following warning:

ld: warning: ignoring file /Users/xanthos/Documents/tabbartest/AVFoundation.framework/AVFoundation, file was built for unsupported file format which is not the architecture being linked (i386)

and of course when using anything of the framework (eg AVAudioSession) i get errors like:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_AVAudioSession", referenced from: objc-class-ref in RadioStreamer.o

I've read so many posts about how to compile AVFoundation Library, by i really don't get it, i'm really inexperienced in all these. I can see there's something with the linking of the library, but not completely understand it.

Any clues please?
Thank you in advance.

like image 664
CdB Avatar asked Mar 25 '12 21:03

CdB


People also ask

What is AVFoundation framework?

AVFoundation is a multimedia framework with APIs in Objective-C and Swift, which provides high-level services for working with time-based audiovisual media on Apple Darwin-based operating systems: iOS, macOS, tvOS, and watchOS. It was first introduced in iOS 4 and has seen significant changes in iOS 5 and iOS 6.

What are frameworks in Xcode?

Frameworks are self-contained, reusable chunks of code and resources you can import into many apps. You can even share them across iOS, tvOS, watchOS and macOS apps.

What is COM Apple AVFoundation?

AVFoundation is the full featured framework for working with time-based audiovisual media on iOS, macOS, watchOS and tvOS. Using AVFoundation, you can easily play, create, and edit QuickTime movies and MPEG-4 files, play HLS streams, and build powerful media functionality into your apps.


1 Answers

It looks like you have you copied AVFoundation.framework from somewhere to your project directory. That's wrong. You just need to add it to the "Link Binary With Libraries" build phase of your project:

  1. In Xcode, select the project in the navigator on the left.
  2. Select the 'Build phases' tab in the main area in the middle.
  3. Open up the 'Link Binary With Libraries' section.
  4. Click the '+'.
  5. Select `AVFoundation.framework. and click 'Add'.
like image 169
mattjgalloway Avatar answered Oct 04 '22 10:10

mattjgalloway