Can you explain canBecomeSubscriber

Based on a twitter thread this morning I want to be clear that before asking this I did run test code...

What does MusicKit's MusicSubscription canBecomeSubscriber indicate.

It is returning false for me - is that because I'm already a subscriber? The docs say it is "A capability that allows your app to present subscription offers for Apple Music."

So will it return false if the user is already a subscriber?

Is there a condition in which it returns false if your user is not already a subscriber? (i.e. is there any reason they can't subscribe from my app using the .musicSubscriptionOffer() modifier?

Thank you,

Daniel

Hello @dimsumthinking,

In MusicKit's MusicSubscription, the canBecomeSubscriber property serves as a hint to the app that it may want to present a subscription offer for Apple Music using the musicSubscriptionOffer(…) presentation modifier.

More generally, MusicSubscription conveys some relevant information about the status of the user as an Apple Music subscriber.

The canPlayCatalogContent property will be set to true whenever the user already has an active subscription to Apple Music that allows full catalog playback, including from third-party apps, which will be the case if the user has chosen any of these plans:

  • the Student Plan;
  • the Individual Plan;
  • the Family Plan.

This property indicates whether catalog playback is expected to work based on the current level of subscription, which means that apps should check this specific capability before initiating playback. That in turn might have an effect on the UI design of the app; for example, an app might want to have a play button somewhere only when playback of catalog content is actually possible.

As implemented currently, whenever canPlayCatalogContent is set to true, then the canBecomeSubscriber property is set to false, to indicate to the app that there is no point in showing a subscription offer for Apple Music.

However, when canPlayCatalogContent is set to false, then canBecomeSubscriber will be set to true, as long as the right conditions are met to allow the user to become a subscriber. Here is a non-exhaustive list of those conditions:

  • the user must be located in a country where the Apple Music service is available;
  • the device must not be somehow restricted from entering subscription flows, which could be the case for managed devices, such as in education settings.

You should definitely check out the last part of our Meet MusicKit for Swift talk from WWDC last year. Between 14:50 and 17:00, the interaction between MusicSubscription and the musicSubscriptionOffer(…) presentation modifier is explained in a fair amount of detail. The code for the app used in that last demo is freely available as an official sample app: Using MusicKit to Integrate with Apple Music.

I hope this helps.

Best regards,

Thanks - those two bullet points were exactly what I was asking. Perfect. Thank you

Can you explain canBecomeSubscriber
 
 
Q