Help adding AVfoundation framework in Xcode

Discussion in 'iOS Programming' started by wrjohns, Jun 24, 2009.

  1. wrjohns macrumors newbie

    Joined:
    May 4, 2009
    #1
    I'm trying to add an AVAudioPlayer class object, which is defined in the AVfoundation framework. When I try to add an existing framework to the Xcode project, AVfoundation isn't one of the choices.

    If I use Finder to look for the file, I have 6 of them, in directories like

    /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/AVfoundation.framework

    There's a similar entry for 2.2.sdk, and 3.0.sdk, for both iPhoneSimulator, as well as iPhoneOS.

    I'm leery about adding one of these manually, since I don't want to have to manually replace it everytime I switch sdk's.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Open the FrameWorks group in your project. Right click on UIKit.framework and choose Reveal in Finder. Choose the AVAudioPlayer.framework from the Finder window that appears and add that one to your project.

    When you switch SDKs it should work correctly. Look at the Get Info window for the frameworks in your project that work and this new one. The settings should be the same.
     
  3. wrjohns thread starter macrumors newbie

    Joined:
    May 4, 2009
    #3
    Thanks. Got it working.

    Noticed a little bit after I posted that the only frameworks showing up were Mac OS ones, and no iPhone ones. Strange that Xcode doesn't point you to the right directory, but ok.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Here's a better way to ensure you get the iPhone frameworks:
    • Get Info on your application target
    • In the General tab, click on the '+' button at the bottom to add a Linked Library
    • Pick your desired framework and click the Add button
     
  5. TenTouch macrumors newbie

    Joined:
    Nov 17, 2009

Share This Page