I'm having a problem with the Scripting Bridge framework in 10.5. Specifically, I use this code to create a new user playlist in iTunes:
NSDictionary *propertiesDict = [NSDictionary dictionaryWithObject:@"playlistName" forKey:@"name"];
playlistToReturn = (iTunesUserPlaylist*)[[[iTunesApp classForScriptingClass:@"user playlist"] alloc] initWithProperties:propertiesDict];
SBElementArray *sourcesArray = [iTunesApp sources];
iTunesSource *librarySource = [sourcesArray objectAtIndex:0];
SBElementArray *userPlaylistsArray = [librarySource userPlaylists];
[userPlaylistsArray addObject:playlistToReturn];
This code works fine in 10.6. The playlist is created correctly, and I can add songs to it later.
However, on 10.5, an error is generated:
Apple event:'core'\'crel'{
'kocl':'cUsP',
'insh':'insl'{
'kobj':'obj '{
'want':'cUsP',
'from':'obj '{
'want':'cSrc',
'from':'null'(),
'form':'ID ',
'seld':42 },
'form':'indx',
'seld':'abso'($206C6C61$) },
'kpos':'end ' },
'prdt':{
'pnam':'utxt'("playlistName") }
};
Error Domain=SBError Code=-10014 UserInfo=0x152c8cb0 "Operation could not be completed. (SBError error -10014.)"
Why?