◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/App Dev
◇ App Dev/2026-07-02Intermediate

Using MusicKit in Rork Max Native Swift — Apple Music Authorization, Search, and Playback in a Minimal Setup

Bringing MusicKit into a Rork Max Swift app: MusicAuthorization, catalog search with MusicCatalogSearchRequest, choosing between ApplicationMusicPlayer and SystemMusicPlayer, and handling non-subscribers with previews and offers.

rork-max40musickitapple-musicswift8media-api

✦ Premium Article

While sketching a focus-music utility, I got stuck on a surprisingly early question: where does the music come from? Third-party streaming SDKs looked tempting, but the review risk and maintenance weight of an external dependency did not add up for an indie developer. So I went with Apple's own MusicKit.

The short version: MusicKit lets you reach the entire Apple Music catalog without running a single server, which makes it an unusually good fit for solo projects. Even developer token issuance and renewal are handled automatically by the framework.

Because Rork Max outputs native Swift, you can walk straight into this territory — no bridging detours like you would need from React Native. Here is the minimal path from authorization to playback, in the order you would actually implement it.

Before Any Code — Two Settings Outside the Project

MusicKit trips people up in configuration before it ever trips them up in code. You need exactly two things.

  1. Enable MusicKit under App Services for your App ID. In the Apple Developer portal, open your App ID under Identifiers and check MusicKit on the App Services tab. This is what authorizes automatic developer token issuance.
  2. Add NSAppleMusicUsageDescription to Info.plist. Explain why you access the user's library. Without it, the app crashes the moment the authorization dialog would appear.

The older way of using the Apple Music API required signing and rotating JWT developer tokens on your own server. Modern Swift MusicKit handles issuance, caching, and renewal automatically once the setup above is in place. That is the entire reason this works serverless.

Authorization — MusicAuthorization.request()

The first code you write is the authorization request. It is a single async call.

import MusicKit
 
@MainActor
final class MusicAccessModel: ObservableObject {
    @Published var status: MusicAuthorization.Status = .notDetermined
 
    func requestAccess() async {
        // Shows the dialog on first run; returns the stored decision instantly afterwards
        status = await MusicAuthorization.request()
    }
}

status is one of .authorized, .denied, .restricted, or .notDetermined. After a .denied, you cannot re-present the dialog from inside the app, so wire up a path to the Settings app via UIApplication.openSettingsURLString.

As for timing: request authorization at the moment the user first touches a music feature, not at launch. Unless music is your app's core purpose, a permission dialog at startup only costs you users.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦The setup that lets MusicKit manage developer tokens for you, plus working code covering authorization, catalog search, and playback end to end
✦A behavior comparison of ApplicationMusicPlayer versus SystemMusicPlayer — and how the choice reshapes what users actually experience
✦Workarounds for the two classic dead ends: Apple Music non-subscribers and simulator playback, plus the settings Rork Max prompts tend to omit
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◇ App Dev2026-10-15
My Ads Never Came Back After a Subscription Expired: Fixing the Direction of an Ad-Free Check
An ad-free flag stayed on after the subscription expired because the check pointed the wrong way. Here is how I rebuilt it to wait for two purchase queries, decide only from confirmed facts, and keep the last value on failure.
◇ App Dev2026-10-15
When adjustsFontSizeToFit Shrinks Just One Row, Suspect the Box Height, Not the String
Only the 10th row of a list drops to 4pt on iOS, though the data and strings are fine. I read the Yoga rounding and font-fit sources, then counted how often the box comes up short in Node.
◇ App Dev2026-10-15
When Only EAS Build Fails with "No matching variant", Check Your Local android/build First
Gradle passes on your machine, but the Android build on EAS stops at "No matching variant of project". Reading the reports on GitHub, I traced how a Windows-generated autolinking cache can reach the Linux builder, and wrote a small script that checks for it before you queue a build.