1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

iPod Integration

Discussion in 'iPhone/iPad Programming' started by kingsapo, Jun 10, 2010.

  1. macrumors member

    Hey all, I'm Matt. I'm new to the forum, but I'll get right down to my problem. I am trying to make a simple application to play songs from the iPod library. Currently, there are two buttons on the form; one is to select a song, which will start playing after you select it. The second is to pause or play the song, depending on the current playback state. My problem is, when I do anything, the app will crash. This includes selecting a new song, pausing/playing the song, even adjusting the volume with the outside buttons. I have included the program in this thread so you guys can take a look. Thanks much for any help you can provide!

    EDIT: Forgot to mention, I'm running on an iPhone 3G, 3.1.3. And no, I am not compiling for iPhone 3.2. Thanks!

    Attached Files:

  2. macrumors 6502

    If you don't write methods for the methods declared in the NSNotification system the app doesn't work. Basically what happens is that you start playing a song and MPMusicPlayerControllerNowPlayingItemDidChangeNotification is triggered and it tries to call the handleNowPlayingItemChanged method which doesn't exist. If you remove the NSNotification bit or include:

    -(void)handleNowPlayingItemChanged:(id) notification{
    //Some function

    it should work.
  3. Moderator


    Staff Member

    A skill to learn is how to read crash reports. Find out what is causing the crash and let us know.
  4. macrumors member

    CarlisleUnited, THANK YOU! I get it now, I was trying to call things that weren't there. Anyways, that fixed it, so THANKS!!!!! :D:D

Share This Page