◉RORK LABJP
●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens
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-11-24
Why Only the First Page of Your Carousel Is Blank at Launch, and How to Make FlatList Start on the Right Page
My wallpaper app opened on an empty first page. Swiping showed page two just fine, and swiping back left page one empty again. The pager had been told where to start before it knew its own size. Here is the Android fix and the Expo FlatList pattern that closes the same gap.
◇ App Dev2026-11-16
I Set cameraPermission to false for a Photo Picker, and the QR Scanner Lost Its Camera Too
In expo-image-picker, cameraPermission: false deletes NSCameraUsageDescription from Info.plist on iOS and blocks CAMERA for every package on Android. Here is what happens when you also use expo-camera, and a working script that checks permissions before you submit.
◇ App Dev2026-11-12
For the Day a Crash You Fixed Refuses to Go Away: Give Every Fix a Flag That Says It Is Active
A fix that worked in debug was silently disabled in release by code shrinking. Record whether each fix is active as a crash-report key and a log line, and confirm it on release day in an Expo Android app.