iTunes purchases don't reliably trigger MPMediaLibraryDidChangeNotification notifications

Originator:deeje
Number:rdar://18570939 Date Originated:2014-10-07
Status:Open Resolved:
Product:iOS SDK Product Version:8.0.2
Classification:Serious Bug Reproducible:Often
 
Summary:
I have an app that plays iTunes previews and encourages people tp buy the songs on iTunes.  In previous iOS releases, when the user comes back into my app, I could detect the purchases song and restart the user experience with the full song.  In iOS 8.0.2, more often than not, changes (purchases) aren't being detected.

Steps to Reproduce:
1. download the Apple same code AVPlayerDemo
https://developer.apple.com/library/IOs/samplecode/AVPlayerDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010101-Intro-DontLinkElementID_2 

2. open the project in Xcode, open the file AssetBrowserSource.m and put a breakpoint on line 168:

- (void)iPodLibraryDidChange:(NSNotification*)changeNotification
{
	[self updateIPodLibrary];
}

3. run the app from Xcode on your device, and switch to the iPod Library Tab, let it load music library.

4. on your device, switch to iTunes and purchase a song

5. once the purchase is complete and the song is downloaded, switch back to AVPlayerDemo App.


Expected Results:
iOS detects a change to your music library and sends a MPMediaLibraryDidChangeNotification

This worked in iOS 7 and before.

Actual Results:
more often than not, no MPMediaLibraryDidChangeNotification is received.  (Doing a query for the song by name using [MPMediaQuery songsQuery] returns nil.)

Version:
8.0.2 (12A405)

Notes:
my app is called tappr.tv.  You can see this bug happen there as well.  Install the app, go thru the first launch sequence but don't sign into any Spotify or Rdio accounts, then play dances from the Featured Dances tab. If you don't have the song in your music library, a preview from iTunes is played.  Tap the iTunes icon in the bottom toolbar, and choose "Purchase…"  You'll be switched to that song in iTunes, where you can complete the purchase, then return to tappr.tv.  Expected result is, on coming to the foreground, my call to [MPMediaQuery songsQuery] with predicates can find that named song, but it doesn't.  If you then choose "Pick…" and search for the song, you can find it, select it, and *then* my code can access and play it.

This worked reliably in tappr.tv on iOS 7 and before.

Configuration:
iPhone 6, 128Gb

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!