Skip to content

Commit 909dbcc

Browse files
committed
fix: call aAuthorizeAndPlayURI on main thread which internally calls UIAppliation.openURL
1 parent b380700 commit 909dbcc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ios/Classes/SwiftSpotifySdkPlugin.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ public class SwiftSpotifySdkPlugin: NSObject, FlutterPlugin {
366366
if accessToken != nil {
367367
appRemote?.connect()
368368
} else {
369-
let appRemote = self.appRemote
370-
Task {
369+
Task { @MainActor in
371370
// Note: A blank string will play the user's last song or pick a random one.
372-
if await appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) == false {
371+
if await self.appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) == false {
373372
throw SpotifyError.spotifyNotInstalledError
374373
}
375374
}
375+
}
376376
}
377377
}
378378

0 commit comments

Comments
 (0)