I am using Spotify iOS SDK, I've followed the tutorial on the official page and everything was fine, until I tried to submit to iTunes connect for testing and I got an error, saying invalid URL Scheme. This what i intially had in the pllist:
spotify-action://
which I then changed to
spotify-action
This allows me to submit to itunes connect, but the sign in flow is broken - when I click sign in, nothing happens. no errors, no warnings.
If I add the "://" into the URL Scheme, Spotify App would launch and it authenticates correctly
this is the function i am using to login:
func openLoginPage() {
let auth = SPTAuth.defaultInstance()
if SPTAuth.supportsApplicationAuthentication() {
guard let url = auth?.spotifyAppAuthenticationURL() else { return }
if #available(iOS 10.0, *) {
if(!UIApplication.shared.openURL(auth!.spotifyAppAuthenticationURL())){
self.showAlertL(message: "Link won't work for some reason", link: url)
}
else{
print("This works - start screen");
print(schemeAvailable(scheme: "\(url)"))
}
print("This is the URL For Spotify ios 10 \(String(describing: auth?.spotifyAppAuthenticationURL()))")
} else {
print("This is the URL For Spotify old \(auth!.spotifyAppAuthenticationURL())")
UIApplication.shared.openURL(auth!.spotifyAppAuthenticationURL())
}
} else {
self.authViewController = self.getAuthViewController(withURL: SPTAuth.defaultInstance().spotifyWebAuthenticationURL())
self.definesPresentationContext = true
self.present(self.authViewController!, animated: true, completion: { () in })
}
}
canOpenURL always returns true, regardless if I am using "spotify-action://" or just "spotify-action" in the URL scheme.
UIApplication.shared.canOpenURL(url)
just in case you were wondering, this is the content of the URL (I've removed the redirect URI part)
spotify-action://authorize?
nolinks=true&
nosignup=true&
response_type=code&
scope=streaming%20playlist-read-private%20playlist-modify-public%20playlist-modify-private%20user-read-private&
utm_source=spotify-sdk&
utm_medium=ios-sdk&
utm_campaign=ios-sdk&