I have a song playlist whose element is MPMediaItem, and I want to share this song playlist, so my original plan was to use persistentID as the identification of the song, but I found that persistentID does not seem to be able to cross devices, use MPMediaQuery persistentID to query the result is empty. So my question is? In this case, what should I do to share this playlist, so that other users can find the corresponding song to play after getting the playlist.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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)
The result log
Hello, I have a music player application that uses MPMusicPlayerController to play Apple Music songs. Now I want to add a Widget to it that can trigger playback pause on iOS 17. How do I need to achieve this? I can get the playbackStoreID of the song on the Widget Extension and use MPMusicPlayerController setQueue(with:) to play it. How do I pass the playbackStoreID in the Widget to the main application for playback, or should I create a new MPMusicPlayerController on the Widget Extension for playback?
@Generable
enum Breakfast {
case waffles
case pancakes
case bagels
case eggs
}
do {
let session = LanguageModelSession()
let userInput = "I want something sweet."
let prompt = "Pick the ideal breakfast for request: (userInput)"
let response = try await session.respond(to: prompt,generating: Breakfast.self)
print(response.content)
} catch let error {
print(error)
}
i want to test the @Generable demo but get error with below:decodingFailure(FoundationModels.LanguageModelSession.GenerationError.Context(debugDescription: "Failed to convert text into into GeneratedContent\nText: waffles", underlyingErrors: [Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character 'w' around line 1, column 1." UserInfo={NSJSONSerializationErrorIndex=0, NSDebugDescription=Unexpected character 'w' around line 1, column 1.})))]))
Topic:
Machine Learning & AI
SubTopic:
Foundation Models
On macOS Tahoe26.0, iOS 26.0 (23A5287g) not emulator, Xcode 26.0 beta 3 (17A5276g)
Follow this tutorial Testing your asset packs locally The start the test server command I use this command line to start the test server:xcrun ba-serve --host 192.168.0.109 test.aar The terminal showThe content displayed on the terminal is: Loading asset packs…
Loading the asset pack at “test.aar”…
Listening on port 63125…… Choose an identity in the panel to continue. Listening on port 63125…
running the project, Xcode reports an error:Download failed: Could not connect to the server. I use iPhone safari visit this website: https://192.168.0.109:63125, on the page display "Hello, world!"
There are too few error messages in both of the above questions. I have no idea what the specific reasons are.I hope someone can offer some guidance. Best Regards.
{
"assetPackID": "testVideoAssetPack",
"downloadPolicy": {
"prefetch": {
"installationEventTypes": ["firstInstallation", "subsequentUpdate"]
}
},
"fileSelectors": [
{
"file": "video/test.mp4"
}
],
"platforms": [
"iOS"
]
}
this is my Manifest.json