SHLibrary.default.items always return empty list

I want use SHLibrary.default.items to show the music i recognized by Shazam. but SHLibrary.default.items always return empty list.

I did an experiment and I called SHLibrary.default.items as soon as I entered on a page and it returned an empty list, but after use SHManagedSession to identify songs and then call SHLibrary.default.items it returned the result I wanted. Below is the test code

private func bindEvent() {
        
        // call when View was create the  items return empty
        if #available(iOS 17, *) {
            let items = SHLibrary.default.items
            print("-------->>>>>>>>\(items)")
        }
       
        self.addToMediaLibray.onTap { [weak self] in
            guard let `self` = self, let result = self.result, let appleMusicID = result.appleMusicID else { return }
            if #available(iOS 17, *) {
                // call when music was recognized the item is not empty.
                let items = SHLibrary.default.items
                print("1111-------->>>>>>>>\(items)")
            }
        }
    }

The attach file is the part of result log My iOS Verion is iOS 17 (21A5326a) XCode Version is 15.0 beta 8 (15A5229m)

Can you post the full implementation of the parent class/struct of bindEvent() and details of where the function is called?

SHLibrary.default.items always return empty list
 
 
Q