iTunesLibrary.framework: doesn’t get cover images from iCloud

Originator:wil.shipley
Number:rdar://14169735 Date Originated:16-Jun-2013 04:29 PM
Status:Open Resolved:
Product:iTunes Product Version:11.0.4
Classification:Crash / Data Loss Reproducible:Always
 
Under the current iTunesLibrary.framework, albums that are on iCloud cannot fetch their cover art using either -[ITLibrary artworkForMediaFile:] or -[ITLibMediaItem artwork].

This is a HUGE problem, since most users (like me!) will have the vast majority of their collection on iCloud only, so previews in any program but iTunes will look horrible. See the attached screenshots—Delicious Library 3 looks like crud, while iTunes 11 looks fine with the same items.

:(

--

Use this sample code if you have none. It just dumps the raw data to the debugger console. Note that iCloud items will have “null” images of {0, 0} size.

//
//  ITTAppDelegate.m
//  iTunesTest
//
//  Created by William Shipley on 6/12/13.
//  Copyright (c) 2013 Delicious Monster Software. All rights reserved.
//

#import "ITTAppDelegate.h"

#import <iTunesLibrary/ITLibrary.h>
#import <iTunesLibrary/ITLibAlbum.h>
#import <iTunesLibrary/ITLibArtist.h>
#import <iTunesLibrary/ITLibArtwork.h>
#import <iTunesLibrary/ITLibMediaItem.h>
#import <iTunesLibrary/ITLibPlaylist.h>


@implementation ITTAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    NSError *error = nil;
    ITLibrary *const iTunesLibrary = [ITLibrary libraryWithAPIVersion:@"1.0" error:&error];

    NSLog(@"iTunesLibrary %@, error %@", iTunesLibrary, error);


    for (ITLibPlaylist *playlist in iTunesLibrary.allPlaylists) {
        NSLog(@"playlist %@", playlist.name);


        if (playlist.distinguishedKind == ITLibDistinguishedPlaylistKindMusic)
            for (ITLibMediaItem *mediaItem in playlist.items) {
                NSLog(@" %@—%@—%@ [%@], %@ %@", mediaItem.title, mediaItem.album.title, mediaItem.artist.name, mediaItem.genre, mediaItem.artwork.image, NSStringFromSize(mediaItem.artwork.image.size));
                if (!mediaItem.artwork)
                    NSLog(@"          artwork for item %@", [iTunesLibrary artworkForMediaFile:mediaItem.location].image);
            }
    }
}

@end


--

iTunesLibrary.framework is now public API, according to this doc: https://developer.apple.com/library/prerelease/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_9.html#//apple_ref/doc/uid/TP40013207-CH100

"iTunes Media Library (iTunesMediaLibrary.framework in /Library/Frameworks). iTunes Media Library provides support for accessing media provided by iTunes from within sandboxed apps. This framework is considered to be a public API as of iTunes 11."

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!