Thanks to the MusicKit team for addressing FB12301908 and FB12301718, but I'm afraid I've discovered even more issues that make MusicLibraryRequest<Album>
difficult/impossible to use on macOS.
Each of these issues is occurring on Sonoma seed 7 and Xcode 15 beta 8.
FB13094022 - MusicLibraryRequest<Album> crashes when no filters are applied with error about MPModelGenre
The following code crashes the app when run against my library (consisting of Apple Music catalog and self-added music) on macOS or Mac Catalyst:
var libraryRequest = MusicLibraryRequest<Album>.init()
let albums = try! await libraryRequest.response()
The error is as follows:
<NSXPCConnection: 0x6000023bc460> connection to service with pid 4331 named com.apple.amp.library.framework: Exception caught during invocation of reply block to message 'performLibraryRequest:withReply:'.
Exception: No identifiers for model class: MPModelGenre from source: (null)
(
0 CoreFoundation 0x000000018ebb08c0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000018e6a9eb4 objc_exception_throw + 60
2 Foundation 0x000000018fcf718c -[NSCalendarDate initWithCoder:] + 0
3 MediaPlayer 0x00000001be7f3e20 -[MPBaseEntityTranslator _objectForPropertySet:source:context:] + 392
4 MediaPlayer 0x00000001be7f41f8 -[MPBaseEntityTranslator _objectForRelationshipKey:propertySet:source:context:] + 296
5 MediaPlayer 0x00000001be7f4088 __63-[MPBaseEntityTranslator _objectForPropertySet:source:context:]_block_invoke_2 + 76
6 CoreFoundation 0x000000018eafe6f4 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 24
7 CoreFoundation 0x000000018eafe5bc -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 268
8 MediaPlayer 0x00000001be7f3fdc __63-[MPBaseEntityTranslator _objectForPropertySet:source:context:]_block_invoke + 436
9 MediaPlayer 0x00000001be82c5c4 -[MPModelObject initWithIdentifiers:block:] + 184
10 MediaPlayer 0x00000001be7f3d80 -[MPBaseEntityTranslator _objectForPropertySet:source:context:] + 232
11 MediaPlayer 0x00000001be7f30e0 -[MPBaseEntityTranslator objectForPropertySet:source:context:] + 32
12 MediaPlayer 0x00000001be8becbc __47-[MPModeliTunesLibraryRequestOperation execute]_block_invoke + 1032
13 iTunesLibrary 0x00000001c2de3584 iTunesLibrary + 83332
14 CoreFoundation 0x000000018eb1c144 __invoking___ + 148
15 CoreFoundation 0x000000018eb1bfbc -[NSInvocation invoke] + 428
16 Foundation 0x000000018fc06698 __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ + 16
17 Foundation 0x000000018fc04d18 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 520
18 Foundation 0x000000018fc04674 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_3 + 188
19 libxpc.dylib 0x000000018e788034 _xpc_connection_reply_callout + 116
20 libxpc.dylib 0x000000018e787f2c _xpc_connection_call_reply_async + 80
21 libdispatch.dylib 0x000000010534ebcc _dispatch_client_callout3 + 20
22 libdispatch.dylib 0x0000000105373e0c _dispatch_mach_msg_async_reply_invoke + 400
23 libdispatch.dylib 0x0000000105357ae8 _dispatch_lane_serial_drain + 368
24 libdispatch.dylib 0x0000000105358e00 _dispatch_lane_invoke + 468
25 libdispatch.dylib 0x000000010536877c _dispatch_root_queue_drain_deferred_wlh + 652
26 libdispatch.dylib 0x0000000105367a54 _dispatch_workloop_worker_thread + 444
27 libsystem_pthread.dylib 0x00000001050abd9c _pthread_wqthread + 288
28 libsystem_pthread.dylib 0x00000001050b3ab4 start_wqthread + 8
)
FB13094588 - MusicLibraryRequest<Album> filtered by .title, equalTo returns blank
The following code returns no results on macOS and MacCatalyst but successfully returns albums on iOS:
var albumNameRequest = MusicLibraryRequest<Album>.init()
albumNameRequest.filter(matching: \.title, equalTo: "The Window")
let nameAlbums = try! await albumNameRequest.response()
It returns no results whether I'm providing a string myself, or using the .title
property of an Album I've already fetched