Следующий код должен показать определенный трек в ITunes:ITunes Scripting Bridge выявить не работает
NSString* iTunesPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.iTunes"];
iTunesApplication *iTunes = nil;
if (iTunesPath) {
iTunes = [[SBApplication alloc] initWithURL:[NSURL fileURLWithPath:iTunesPath]];
[iTunes setDelegate:self];
}
iTunesSource *librarySource = nil;
NSArray *sources = [iTunes sources];
for (iTunesSource *source in sources) {
if ([source kind] == iTunesESrcLibrary) {
librarySource = source;
break;
}
}
SBElementArray *libraryPlaylist = [librarySource libraryPlaylists];
iTunesLibraryPlaylist *iTLibPlaylist = nil;
if ([libraryPlaylist count] > 0) {
iTLibPlaylist = [libraryPlaylist objectAtIndex:0];
}
SBElementArray *fileTracks = [iTLibPlaylist fileTracks];
iTunesFileTrack *track = [fileTracks objectAtIndex:4];
NSLog(@"Try to reveal track: %@ at path :%@",[track description],[[track location] path]);
[track reveal];
Выход:
Try to reveal track: <ITunesFileTrack @0x1364ed20: ITunesFileTrack 4 of ITunesLibraryPlaylist 0 of ITunesSource 0 of application "iTunes" (2474)> at path :/Users/...
Но совершенно отметить случается. Что я делаю не так? (iTunes Version: 9.0.3)
решена моя проблема. Большое спасибо! – V1ru8