Post not yet marked as solved
Upon reading the Apple Music Best Practices for App Developers and the Apple Music API FAQ, I am confused whether developers are able to use the Apple Music API/MusicKit to create apps that can generate revenue. Here is the specific verbiage that I located:Apple Music Best Practices for App Developers"Moreover, your app may not require payment or indirectly monetize access to the Apple Music service (e.g. in-app purchase, advertising, requesting user info, etc.)."Apple Music API FAQWhat are some common integrations of the Apple Music API that are inappropriate and would be rejected by App Review?Apps forcing an in-app purchase, advertising, requesting user information to monetize or gate access to Apple Music API will be rejected.My main questions are:Are there acceptable types of advertising permissible under these guidelines? If yes, can some general examples be provided.Are there acceptable types of subscription/in-app purchases permissible under these guidelines? If yes, can some general examples be provided.
Post not yet marked as solved
We integrated Apple Music into our app and would like to allow users to subscribe to Apple Music if they want to.The problem is that we get a "we've run into a problem" screen from Apple Music. The only we can make it work is by following these steps:1) Sign out of iTunes Store account on iPhone, iPad or iPod touch.2) Restart device.3) Sign back in to your iTunes Store account.4) Launch the app and tap on our Subscribe to Apple Music button5) We get a functioning page where user can subscribe to Apple MusicThe thing is: if we dismiss that page, go back to our app and then try again we go back to "We run into a problem" screen.But that's not really good UX.Has anyone encountered his issue before? Help would be much appreciated!Thanks!Giorgia
Post not yet marked as solved
Hi, thanks for MusicKit.Using the sample app provided at: https://developer.apple.com/musickit/The UI will freeze when selecting a song. This is linked to MPMusicPlayerController, which sets the queueIDs of the songs. It is particularly noticeable when selecting multiple songs in a tableView or collectionView. If I select a cell in a collectionView that is associated with MPMusicPlayer's prepareToPlay method, and then quickly select another cell, The UI will almost always freeze. This is not a good user experience.What can we do to improve MPMusicPlayerController? prepareToPlay will download the song to the device, but can this be dispatched to a background thread? My app experience could be extremely improved, even entertaining, if this can be fixed!Can anyone give some pointers, or discuss MPMusicPlayerController with me?I would like to continue working and building with MusicKit, it would be excellent if we can move these download tasks to background threads to free up the UIThanks
Post not yet marked as solved
I get a few seconds delay intermittently when playing or skipping a song (even ones downloaded). This functionality works perfectly in the native music app or the control centre widget. Even the "Adding Content To Apple Music" sample code app is very laggy. This bug needs to fixed because it makes users think the app is frozen, thus ruining the app user experience.Please submit your own bug reports to apple if you are having this problem so we can get this issue resolved faster!
Post not yet marked as solved
Hello guys I am currently working on an iOS App that lets you Listen to Music and I am using the MPMusicPlayerController for playback!When setting up the Music Player I also set the shuffleMode but sometimes setting it fails:[SDKPlayback] Failed validators: {(
setShuffleMode
)}Now I would not really have a problem with the failure since I can try it again later tough a big problem is that when this error occurs the whole App freezes.Since I can/ should call functions of the MPMusicPlayerController only on the Main Thread I don't know how to prevent this from happening.Is there some check I can make before trying to set ShuffleMode or any other ways you can think of, preventing the App from Freezing?Thanks a lot for your help
Post not yet marked as solved
Hi,Since today, we are no more able to do DELETE/PUT request on the Apple Music API.So, we can't update a playlist details, delete a playlist, delete tracks in playlist, delete tracks in library...Old methods allowed are now returning only an HTTP Code 403.Why this change in the Apple Music API ? We can hope that will be back soon ?
I've searched and searched but can not find objective-c sample code to access Apple Mussic from an app I am writing.Any help would be appreciated.
Post not yet marked as solved
I am trying to access API of Apple Music API > https://developer.apple.com/documentation/applemusicapiAfter creating the JWT developer token, when i try to access the API, An error of 401 - Unauthorized occurs. I am doing it in the following way : 1) Registering a new music identifier > https://help.apple.com/developer-account/#/devce5522674?sub=dev0416b90042) Creating a MusicKit identifier and private key > https://help.apple.com/developer-account/#/devce5522674 also downloading the private key file. 3) Getting the Kid (Key Id) and issuer (Team Id) . 4) Running the following code to generate the token : const jwt = require("jsonwebtoken");
const privateKey = fs.readFileSync("AuthKey_KEY_ID.p8").toString();
const teamId = TEAM_ID_HERE;
const keyId = KEY_ID_HERE;
const jwtToken = jwt.sign({}, privateKey, {
algorithm: "ES256",
expiresIn: "120d",
issuer: teamId,
header: {
alg: "ES256",
kid: keyId
}
});
console.log(jwtToken);And after that checking the code using the curl command : curl -v -H 'Authorization: Bearer [developer token]' "https://api.music.apple.com/v1/catalog/us/songs/203709340" I am not sure what i am missing here. is it something related to access or is it my code.P.S : I am the Account Holder, so it is not an issue related to role. Thanks
Post not yet marked as solved
I've got an app that allows a user to add songs to playlists in their library.I'd like to be able to delete songs as well, but it appears that there is no way to do this?It's baffling that this fundamental functionality is missing. Is there some super important reason that this is not possible? If so, what might that be?Are there plans to allow this functionality in the future?Thanks...
Post not yet marked as solved
I'm getting a variety of errors when I call prepareToPlay on the MPMusicPlayerController. Sometimes they happen, sometimes they don't. I'm trying to play songs from the Apple Music service. When I don't get the errors, it plays just fine. I have iOS v13.5.1 on my iPhone Xs and I'm using Xcode 11.5. This is my code:
let applicationMusicPlayer = MPMusicPlayerController.applicationMusicPlayer
applicationMusicPlayer.setQueue(with: [trackID])
applicationMusicPlayer.prepareToPlay(completionHandler:{ error in
if let error = error {
print(error.localizedDescription)
return
}
DispatchQueue.main.async{
applicationMusicPlayer.play()
}
}
These are the various errors I'm getting:
[SDKPlayback] Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=2 "Queue was interrupted by another queue" UserInfo={NSDebugDescription=Queue was interrupted by another queue}
[SDKPlayback] Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=9 "Preparing queue timed out" UserInfo={NSDebugDescription=Preparing queue timed out}
[SDKPlayback] Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=6 "Failed to prepare to play" UserInfo={NSDebugDescription=Failed to prepare to play}
[SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong]
I get this error message in the OS Logs when I run the sample code from this Apple link - https://developer.apple.com/documentation/sirikit/media/managing_audio_with_sirikit:
Failed to fetch user token error: An unknown error occurred
Return code is 0 too which seems strange as well.
I've generated a JWT using swift run generateToken <team-id> <key-id> from the SwiftJWTExample package:
JSON Web Token:
"<token here>"
Header:
{"typ":"JWT","alg":"ES256","kid":"..."}
Payload:
{"iss":"...","iat":...,"exp":...}
Signature:
...
And have checked my team id and key id. I've enabled App groups for the extension and the main target, and Siri for the main target, and am running on an iOS 14 device, compiled with Xcode beta.
Hope you can help me out!
Post not yet marked as solved
On a macOS app generated with Catalyst, the method SKCloudServiceController.requestUserToken(forDeveloperToken:completionHandler:) returns a SKErrorDomain. The error is:
Error Domain=SKErrorDomain Code=0 "Ocorreu um erro desconhecido" UserInfo={NSLocalizedDescription=Ocorreu um erro desconhecido}
Has something changed regarding this method on macOS or is this a bug?
Post not yet marked as solved
Hello Apple World,
I am working on an app that adds Apple Music songs to an MPMediaPlaylist.
I was able to do this successfully in iOS 13.7.
However, today I started testing on iOS 14.0.1 and the same code causes my app to freeze completely.
print("PlaylistManager.addItem playlist \(playlist) identifier \(identifier) MPMediaLibrary.authorizationStatus() \(MPMediaLibrary.authorizationStatus().rawValue)")
playlist.addItem(withProductID: identifier) { (error) in
if error != nil {
print("An error occurred while adding an item to the playlist: \(error!.localizedDescription)")
}
}
Output:
"PlaylistManager.addItem playlist <MPConcreteMediaPlaylist: 0x2819dc4d0> identifier 1531532609 MPMediaLibrary.authorizationStatus() 3"
Because I don't get any errors printed (the app just freezes up) and I don't see any crash logs in Devices and Simulators, I am not sure how to proceed.
Is anyone else running into this issue with MPMediaPlaylist.addItem in iOS 14?
Is there a general way to debug app freezes?
Any help will be very much appreciated;
Thank you in advance!
Marvin
Post not yet marked as solved
I have the checkboxes enabled in Music. Clicking on any individual checkbox does not visually remove the checkmark, however when you right click, it reports either Uncheck Selection or Check Selection. The checkmark remains no matter if clicked on or not.
Post not yet marked as solved
I'm working on an app that communicates with the Apple Music API. I'm attempting to run the app on a simulator (ios 14.2). When I run this code:
SKCloudServiceController().requestUserToken(forDeveloperToken: developerToken) { (receivedToken, error) in
print(receivedToken ?? "No Token")
print(error)
guard error == nil else { return }
// the rest of the code that never gets called ...
}
It prints this error:
Error Domain=SKErrorDomain Code=9 "The latest Apple privacy policy has yet to be acknowledged" UserInfo={NSLocalizedDescription=The latest Apple privacy policy has yet to be acknowledged}
And obviously I get no user token.
How do I Acknowledge the latest Apple privacy policy?
I am signed in with my apple Id in my simulator. I can use apple music on my regular iPhone and I can use Apple Music on OS X without Apple asking me to acknowledge Privacy Policy. Is there some way of provisioning user data on the app for testing purposes?
Post not yet marked as solved
Often we get the error below when we invoke skipToPreviousItem or skipToNextItem. Can anyone shed any light on what it means or how to fix it? These errors don't seem to actually stop the music playing, so it would be good even if there was a way we could not show the alert popups. It would also be good if anyone knows how to control the kit to make it not show error dialog (like using a try-catch error before it shows)?
PLAY_ACTIVITY: A play stop() method was called without a previous play() descriptor
Anyone seen this and been able to fix it?
Thanks
Post not yet marked as solved
Does anyone have a step-by-step "official" guide to getting MusicKit working with iOS inside Xcode when developing an app in Swift?
Post not yet marked as solved
I’m converting a MusicKit app from iOS to macOS with Catalyst but can’t get the player to work. The app works flawlessly on iOS but I get the following error in my console on macOS whenever the MPMusicPlayer tries to manipulate the queue by adding a song with a store id
[SDKPlayback] Failed to obtain remoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated.}
Both the player, setQueue and play methods are according to the documentation supported on Mac Catalyst 13+:
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/1624253-setqueue
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/2582424-preparetoplay
https://developer.apple.com/documentation/mediaplayer/mpmediaplayback/1616255-play
Post not yet marked as solved
I want to use Apple Music using MusicKit.
I've created MusicKit identifier and private key by following all the steps mentioned here: https://help.apple.com/developer-account/#/devce5522674
I have my Team ID, the Music key ID and the private key (.p8 file) with me.
I tried to generate the required JWT token by using many scripts that were mentioned in similar questions asked here, but none of them have worked so far. When I try to authenticate, I'm getting an error ERROR_FAILED_TO_VERIFY_JWT.
Ref: Codes I've tried to generate the JWT token from: Thread 130168 - https://developer.apple.com/forums/thread/130168
A nice and simple blog by Lee Martin [Blog - Creating an Apple Music API Token]
Thread 79074 - https://developer.apple.com/forums/thread/79074
Many other links
But sadly, none of them worked and I had to post this question.
I have tried the sample Android app: https://developer.apple.com/download/more/?=Android%20MusicKit
After authentication, the page goes on with an infinite loader, which I believe must be because of the same error ERROR_FAILED_TO_VERIFY_JWT
Also tried with this HTML page:
<html>
<head>
<meta name="apple-music-developer-token" content="the-JWT-token-generated-using-the-reference-links">
<meta name="apple-music-app-name" content="My App Name">
<meta name="apple-music-app-build" content="1978.4.1">
</head>
<body>
<button id="apple-music-authorize"></button>
<button id="apple-music-unauthorize"></button>
</body>
<script src="link-to-musickit.js"></script>
<script>
let music = MusicKit.getInstance();
		music.player.play();
		music.authorize().then(function() {
				music.player.play();
		});
		music.authorize().then(function() {
				 music.api.library.albums.then(function(cloudAlbums) {
							// user's cloudAlbums
				});
		});
</script>
</html>
Post not yet marked as solved
We're using
https://developer.apple.com/documentation/musickitjs to authorize Apple music, on Desktop it opens a new window to authorize to apple.
But It's NOT working on mobile In-App Browser (both iOS & Android), probably because on mobile messenger, it's not possible to allow the opening of multiple windows.
Are we missing something here? Any workaround for it?
Has anyone done that?