Faruk
Faruk

Reputation: 169

iOS 10 can't open spotify app

In iOS 10 I can't open Spotify app from my app. This worked in iOS 9:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"spotify:"]]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"spotify:"]];
}
else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/spotify"]];
}

For iOS 10 I added:

<key>LSApplicationQueriesSchemes</key>
    <array>
     <string>spotify</string>
    </array>

But nothing happens. Anyone had same issue?

Upvotes: 0

Views: 297

Answers (2)

Jack Spade
Jack Spade

Reputation: 1

I have the same problem, and I try other keyword, and it's okay.

spotify -> spoitfyltd, https://itunes.com/apps/spotifyltd

#define SPOTIFY_URL @"https://itunes.com/apps/spotifyltd"

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:SPOTIFY_URL]]) {
            [[UIApplication sharedApplication]openURL:[NSURL URLWithString:SPOTIFY_URL] options:@{}
                                    completionHandler:^(BOOL success) {
                                    }];
        }

Upvotes: 0

Edwin Finch
Edwin Finch

Reputation: 903

Adding spotify to your LSApplicationQueriesSchemes is necessary in iOS 10, and since you've done that, you should be able to open spotify:// links. Doing so works for me.

On my device, spotify: and spotify:// both open the Spotify iOS app properly after launching them (with exactly the same code as you shared in your first block there).

What I'd recommend doing is cleaning your project's build folder (Command-Shift-Option-K) and then rebuilding the app. It should ensure a clean build in case something went wrong in case of a mixup between plist files or what have you.

Upvotes: 1

Related Questions