I am trying to check whether Spotify
is installed on iPhone with my code and Spotify
is already installed on my device. However its always in else
block in code below
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"spotify://"]]) {
//open spotify
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"spotify://"]];
}
else
{
[SVProgressHUD showErrorWithStatus:@"Spotify was not installed"];
[SVProgressHUD dismissWithDelay:1.00];
}
However I can successfully open Spotify with the code below:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"spotify://"]];
I am wondering why canOpenURL
is not working for Spotify
while it works for Apple Music
with music://
URL Scheme.