I have a application which gets audioCDPlayList from iTunes. This app works fine up to macOS High Sierra, but does not work correctly on macOS Mojave Beta 3 (18A326h).
I have investigated the reason and then found that the following strange behavior:
GetAudioCDInfoFromiTunes.h
#import <Foundation/Foundation.h>
#import <ScriptingBridge/ScriptingBridge.h>
#import "iTunes.h"
@interface GetAudioCDInfoFromiTunes : NSObject
- (NSMutableDictionary *)getAudioCDInfoFromiTunes;
@end
GetAudioCDInfoFromiTunes.m
- (NSMutableDictionary *)getAudioCDInfoFromiTunes {
// Declear iTunes scripting bridge variable
iTunesApplication *iTunesApp = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
SBElementArray *sources = [iTunesApp sources];
NSLog(@"sources=%@", sources);
NSLog(@"count=%ld", [sources count]);
iTunesPlaylist *aAudioCDPlayList = nil;
for (iTunesSource *src in sources) {
NSLog(@"src=%@", src);
SBElementArray *playlists = [src audioCDPlaylists];
NSLog(@"playlists=%@", playlists);
for (iTunesPlaylist *aPlaylist in playlists) {
NSLog(@"aplaylist=%@", aPlaylist);
if ([aPlaylist isKindOfClass:[NSClassFromString(@"ITunesAudioCDPlaylist") class]]) {
aAudioCDPlayList = [aPlaylist get];
break;
}
}
}
... SNIP ...
}
Executing the above code, NSLog of Line.8, count
of sources
is 0. And therefore for
loop of Line.12 don't work. Then the result [aPlaylist get]
is null.
Does anyone know the reason why the count
of sources
is 0?
Plase let me know how can I run my ScriptingBridge code on Mojave Beta...