js_
js_

Reputation: 4731

iPhone: How to know music item is unsynced?

I'm creating a music app.

Are there a way to know if MPMediaItem is unsynced while my app is playing it or displaying it on a table view?

On a table view, now I check if MPMediaItem is nil or not.
Is it good way?

A playing MPMediaItem doesn't become nil after it is unsynced.
So I can't know it is unsynced or not.

I thought there was a notification of syncing iTunes.
But I can't find such notification.

Upvotes: 1

Views: 303

Answers (1)

amergin
amergin

Reputation: 3176

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(notification_iPodLibraryDidChange:)
                                             name: MPMediaLibraryDidChangeNotification
                                           object:nil];

[[MPMediaLibrary defaultMediaLibrary] beginGeneratingLibraryChangeNotifications];

Not sure what happens if your library changes under you but I suppose it would be easy enough to check using the above notification.

Upvotes: 2

Related Questions