iOS Swift Tutorial: Stream Music from Spotify

Daniel Autenrieth · 38K views · 2015 · 56:59

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when they are setting up Spotify SDK login and token refresh in an iOS app and need a worked example to follow.

Recommended by 1 people across 1 different months, 2015 to 2017.

What it is

A nearly hour-long Swift tutorial from 2015 that walks through building an iOS app that streams music with the Spotify SDK. It covers Spotify authentication, including setting up a token swap and refresh service, and playing tracks, presented by Daniel Autenrieth.

What people said

Recommends Christian Fox · 2017-03 · Stack Overflow · on “Login to Spotify fails when using ad-hoc distribution”

For anyone else that has the same problem I have found a solution. It seems the problem was due to not using refresh tokens or at least adding refresh tokens got things working. I managed to get my app working by following this YouTube tutorial [this video] and referring to the code in the demo project found with the Spotify SDK [LINK] . The ruby app used in the tutorial can be found here [LINK] . I hope that helps someone else too, I didn't make detailed notes about what I did so can't give anymore info than that but happy to try and help if you have a question.

Cites Ega Setya Putra · 2015-07 · Stack Overflow · on “How to renew spotify session?”

I have an application that allow users to stream songs from spotify. So to achieve that I need to renew session from time to time whenever users want to stream song from spotify. I'm using latest spotify sdk (beta-9), and I'm currently following tutorial from [this video] . In that tutorial we need to refresh token swap but when I looked from [LINK] there is no need to refresh token swap. and I end up not using the token swap, when I refresh my session then play song with renewed session, I got below error: Error Domain=com.spotify.ios-sdk.playback Code=8 "Login to Spotify failed because of invalid credentials." UserInfo=0x7f840bf807b0 {NSLocalizedDescription=Login to Spotify failed because of in

Cites Jojo · 2015-12 · Stack Overflow · on “Spotify login: canOpenURL: failed for URL: "spotify-action://" - error: "This app is not allowed to query for scheme spotify-action"”

I'm trying to read spotify music in my app in swift. I followed the beginner user and the youtube tutorial "iOS Swift Tutorial: Stream Music from Spotify" [this video] but I can't success login. I have this error and don't know why : canOpenURL: failed for URL: "spotify-action://" - error: "This app is not allowed to query for scheme spotify-action" I have a ClientID, SecretID, BundleID, and URI in my developper spotify account. I precise that is not a problem of LSApplicationQueriesSchemes : "The LSApplicationQueriesSchemes key is not needed since Beta 10 do not support Spotify App Authentication." How to resolve this ?

Cites Jojo · 2015-12 · Stack Overflow · on “Login impossible with Spotify iOS 9”

I can't login with ios sdk spotify. I followed the Brian's tutorial ( [this video] ) and there is a difference with the current spotify tutorial : In the video it talks about token exchange and show a spotify webpage. However on current spotify webpage the paragraph is missing. Does this exchange token must be installed ? I defined all elements in my spotify app account. I also defined in the URL schemes : "spotify-action", "my-app-Name" but I can't sucess login. Anyone help please ?

Cites Gabriel Piffaretti · 2016-04 · Stack Overflow · on “(Spotify iOS SDK) renewSession always return nil session”

I am building a small app on iOS that uses the Spotify SDK in order to make requests to its Web Api. The thing is, I am using the function STPAuth.renewSession to renew the token whenever I want to make a request. But for that function documentation says 'If no token refresh service has been specified the callback will return nil as session'. And that's what is happening to me. I'm always getting a nil 'renewedSession' ( [LINK] :) I ve searched over there and found that this guy on this video uses a server that runs some script and he turns on using terminal, specifying a token refresh service URL on his app ( [this video] ) but nothing of that appears mentioned on the Spotify's iOS SDK tutorial.

Cites ChristophA · 2016-09 · Stack Overflow · on “Cannot convert value of type '(NSError!, SPTSession!) -> Void' to expected argument type 'SPTAuthCallback!'”

I'm trying to follow a tutorial ( link [this video] and I just converted my application to the latest Swift3-Syntax. Unfortunately there are still some errors, which I just cannot fix. I would appreciate any tips. The errors: Image [LINK] My AppDelegate.swift: import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { let kClientID = "cfa6ab909e8349bcb78d4924e1d7a32c" let kCallbackURL = "spotifytutorial://returnAfterLogin" let kTokenSwapURL = " [LINK] " let kTokenRefreshServiceURL = " [LINK] " var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override po

Cites GarySabo · 2017-03 · Stack Overflow · on “Using the Spotify SDK in iOS using Swift 3.0”

Spotify's beginner tutorial is only in Objective-C [LINK] , but using this along with this video: [this video] I was able to get my development environment set up properly, however the SDK's methods (stuck on log in) have changed since that video was posted...can anyone tell me how to convert the log in methods into Swift? I'll be happy to open source my code once i get it running.