views:

6163

answers:

8

Hi,

AVFoundation.framework is not where the documentation says it should be. I have iPhone SDK 2.2 installed (never had previous sdk versions installed) and I can't find that folder under /System/Library/Frameworks

I did find it under /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/System/Library/Frameworks/ folder but if I add it from that location, then the compiler can't find the header files. I tried copying the entire AVFoundation.framework folder to /System/Library/Framework, but it still can't find the header files.

How can I use AVFoundation classes?

Thanks, Alex

+4  A: 

I've used the AVFoundation classes in my code, and added it the same way you did. You cannot browse the headers for some unknown reason, but putting this in your classes header file compiles just fine:

#import <AVFoundation/AVAudioPlayer.h>

I've submitted my app and had it approved, so I don't think there's anything wrong with this approach. The AVFoundation reference remains red in XCode, but it seems to work fine. Deleting the framework reference causes compile errors, so it definitely needs to be there.

rustyshelf
Thanks! Your answer made me realize I was importing AVFoundation.h instead of AVAudioPlayer.h and that was the reason it didn't compile
subjective-c
in that case you should mark this question as answered, that's how the whole stack overflow thing works. You can also up/down vote my answer depend on whether it's good or not.
rustyshelf
A: 

I have the same problem with AVFoundation framework It isn't on it's place (I mean at System\Library\Frameworks) - but it can be found in other FIleSystem place (I used find AVFoundation) than drag'n'drop it into my frameworks folder. All compiling just fine, but when I call [player play] or [player prepareToPlay] these two methods always return NO! I've tried to use different files (even try to remade whole procedure on another PC - but didn't even reach compile success)

Can anyone give somy ideas what is wrong? (using SDK 2.2.1 macOS 10.5.5)

A: 

Hm, I take it this framework won't work on a OS 2.1 iPhone, right?

MihaiD
Nope - the framework was only added starting OS 2.2
Adi
+7  A: 

I was having all sorts of problem until I realized I have to change the "active executable" to "iPhone Simulator 2.2" too. Here's the steps I took:

Add the AVFoundation framework to your project. Ctrl-click on Frameworks folder and select "Add existing frameworks". The default framework directory in "/System/Frameworks" may not contain the new AVFoundation framework file, so you will need to navigate very deep into the iPhone SDK directory to find the file. I found mine in /Developer/Platforms/iPhoneSimulator.platform/developer/SDKs/iPhoneSimulator2.2.sdk/System/Library/Framework. (Yes, it is that deep!!).

Now from your XCode, select your Active SDK to be "Simulator - iPhone OS 2.2" and select your "Active Executable" to be "iPhone Simulator (2.2)"

That solved the problem for me. Hope yours is the same issue.

A: 

Just to chime in, my app wouldn't compile with the framework in "/Developer/Platforms/iPhoneOS.platform..." but was happy (on device) with the "/Developer/Platforms/iPhoneSimulator.platform/..." above.

A: 

Thanks for the help everyone.

I think we can be pretty sure that the frameworks in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks/ are okay, as this is where the (Apple supplied) iPhone project stationary picks up the UIKit.framework from! That's good enough for me, anyway.

Cheers, Benjohn

A: 

I found mine at:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks

Aneesh Abraham
A: 

when i browse and add a framework from a different sdk version, all other frameworks lose their path and nothing compiles. This really sucks!

Vk