Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

How to check if MPMediaLibrary did change ?

Gi-loGi-lo Posts: 28Registered Users
Hey folks ;),

I am building a music application and therefore I cache some data which I grab from the users iPod library first. I need to recreate the cache whenever the iPod library changes so I took a look at MPMediaLibrary.

Actually I found 2 interesting things:

lastModificationDate ->
Due to some googling, I know that this also gets called when the user creates a new playlist or such. Even worse, in my case it shows up the same date all the time.

NSLog(@\"%@\", [[MPMediaLibrary defaultMediaLibrary] lastModifiedDate]); // Always the same date


beginGeneratingLibraryChangeNotifications ->
The problem I have with this, is that after the notification is sent the MPMediaQuery is still the same. After around 5 seconds it changes. I dont want to let my users wait 5 seconds ... :/

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_handle_MediaLibraryDidChangeNotification)
name:MPMediaLibraryDidChangeNotification
object:[MPMediaLibrary defaultMediaLibrary]];
[[MPMediaLibrary defaultMediaLibrary] beginGeneratingLibraryChangeNotifications];


All in all I am pretty frustrated now. Is there no way to check if the iPod library did change?
Post edited by Gi-lo on
Please follow me on Twitter and take a look at my website.

Feel free to add me on AIM (GiloMTTM) to ask me whatever you want <img src="http://www.

Replies

  • iSDKiSDK Posts: 1,353Tutorial Authors, Registered Users
    Might help, iphone - Load songs from iPod Library right after sync - Stack Overflow

    Max.
    Gi-lo;358355 said:
    Hey folks ;),

    I am building a music application and therefore I cache some data which I grab from the users iPod library first. I need to recreate the cache whenever the iPod library changes so I took a look at MPMediaLibrary.

    Actually I found 2 interesting things:

    lastModificationDate ->
    Due to some googling, I know that this also gets called when the user creates a new playlist or such. Even worse, in my case it shows up the same date all the time.

    NSLog(@\"%@\", [[MPMediaLibrary defaultMediaLibrary] lastModifiedDate]); // Always the same date


    beginGeneratingLibraryChangeNotifications ->
    The problem I have with this, is that after the notification is sent the MPMediaQuery is still the same. After around 5 seconds it changes. I dont want to let my users wait 5 seconds ... :/

    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(_handle_MediaLibraryDidChangeNotification)
    name:MPMediaLibraryDidChangeNotification
    object:[MPMediaLibrary defaultMediaLibrary]];
    [[MPMediaLibrary defaultMediaLibrary] beginGeneratingLibraryChangeNotifications];


    All in all I am pretty frustrated now. Is there no way to check if the iPod library did change?
  • Gi-loGi-lo Posts: 28Registered Users
    iSDK;358362 said:
    Thanks for the tip but initializing an instance of MPMediaPicker is always not nil for me. Also I cannot listen for "lastModificationDate" changes, as in my case it is never changing :/
    Please follow me on Twitter and take a look at my website.

    Feel free to add me on AIM (GiloMTTM) to ask me whatever you want <img src="http://www.
Sign In or Register to comment.