Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Link to original issue post on Github: https://github.com/spotify/ios-sdk/issues/183
Hi everyone, I have spent many hours now and have still not been able to resolve this issue I had several months ago with the iOS SDK. Another user on Github had the same issue, so I'm hoping someone on these boards will have an idea.
I'm using the Authorization code flow, but when I call initiateSession and am redirected to the Spotify app, I see the "authorizing ..." pop-up but then when it finishes I get an "X" rather than the usual checkmark and am redirected back to my app. No sessionManager delegate function (didFailWith, for example) is called and my app just hangs.
Of note:
The only workaround that I have found so far is to remove Spotify from LSApplicationsQueriesScheme in my info.plist. This forces my app to use the web view authorization flow. Obviously this is slower and much worse UX than an automatic authorization using SFAuthentificationSession.
Does anyone know why this might be happening? I also don't know how to get logs from the call to sessionManager.initiateSession so any help with that would also be greatly appreciated
Solved! Go to Solution.
Hope it would help you.
A. no dialog:
You forget one thing in AppDelegate.swift. Add the code to process the response from spotify. After this process , delegate of sessionManager will be called.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
rootViewController.sessionManager.application(app, open: url, options: options)
return true
}
But after ios 13, it wouldn't call thie func above.You need to do as follow.
1. Add openURLContexts func in SceneDelegate file to process the same thing of openURL in appdelegate.
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
UIOpenURLContext *ctx = [URLContexts allObjects][0];
ViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
[rootVC.sessionManager application:[UIApplication sharedApplication] openURL:ctx.URL options:ctx.options];
}
2. remove UISceneConfigurations section from info.plist. Then it will callback to openurl.
B.authorization error. Check below.
Something to do:
1.DASHBORAD:
add bound id;
redirecturl;
2.APP:
add LSApplicationQueriesSchemes;
add URL Types:
3.rb script:
change your client id;
cahnge your redirecturl;
Hope it would help you.
A. no dialog:
You forget one thing in AppDelegate.swift. Add the code to process the response from spotify. After this process , delegate of sessionManager will be called.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
rootViewController.sessionManager.application(app, open: url, options: options)
return true
}
But after ios 13, it wouldn't call thie func above.You need to do as follow.
1. Add openURLContexts func in SceneDelegate file to process the same thing of openURL in appdelegate.
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
UIOpenURLContext *ctx = [URLContexts allObjects][0];
ViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
[rootVC.sessionManager application:[UIApplication sharedApplication] openURL:ctx.URL options:ctx.options];
}
2. remove UISceneConfigurations section from info.plist. Then it will callback to openurl.
B.authorization error. Check below.
Something to do:
1.DASHBORAD:
add bound id;
redirecturl;
2.APP:
add LSApplicationQueriesSchemes;
add URL Types:
3.rb script:
change your client id;
cahnge your redirecturl;
Hi Ouml,
Thanks so much for your help. With your suggestions, I figured out the problem was that the Bundle ID I had listed in my Spotify Dashboard settings was antiquated and no longer was the same as the bundle ID in my XCode project. In my Info.plist, I was using the CFBundleURLName of the XCode project, not what was in the dashboard, so I added my XCode bundle ID to my Spotify project dashboard, and now it is working again. Thanks again!
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…