PDA

View Full Version : iPod Integration




kingsapo
Jun 10, 2010, 04:44 PM
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!



CarlisleUnited
Jun 10, 2010, 05:47 PM
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.

dejo
Jun 10, 2010, 06:36 PM
My problem is, when I do anything, the app will crash.
A skill to learn is how to read crash reports. Find out what is causing the crash and let us know.

kingsapo
Jun 10, 2010, 07:08 PM
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