Q:

Login to Spotify fails when using ad-hoc distribution

I'm using the Spotify SDK in an iOS app and login is working when running in the simulator or running on a device when I've installed the app directly from Xcode. When I distribute an Ad-Hoc build of the app (using Fabric) the method call 
[self.player loginWithAccessToken:self.auth.session.accessToken];

fails to complete and the user is never logged in. If following  Spotify's own tutorial this method gets called on the main thread and so blocks it, if I wrap it in a dispatch_async call onto a background thread then the UI is not blocked but the user is still not logged in.
I have tried with both a wildcard provisioning profile and an app specific one but that didn't make a difference.
The demo project included with the iOS-beta 25 SDK does work (can login) when distributing an Ad-Hoc build. That is using Spotify's example app, callback and client ID and similar but not identical code. 
My question is then what I am not doing for a distributed build that I should be?

A:

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 and referring to the code in the demo project found with the Spotify SDK . The ruby app used in the tutorial can be found here.
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.

