-1
當用戶按下特定的UIButton
時,應用程序應該在Spotify
應用程序中打開一首歌曲,如果該應用程序不存在於手機上,我需要它將用戶轉到AppStore
Spotify
應用程序,以便用戶可以下載它。點擊按鈕進入`AppStore`
艾想法我怎麼能這樣做?
謝謝。
當用戶按下特定的UIButton
時,應用程序應該在Spotify
應用程序中打開一首歌曲,如果該應用程序不存在於手機上,我需要它將用戶轉到AppStore
Spotify
應用程序,以便用戶可以下載它。點擊按鈕進入`AppStore`
艾想法我怎麼能這樣做?
謝謝。
要做到這一點,你必須:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:spotifyUrl]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:spotifyUrl]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:linkOfSpotifyOnAppstore]]
}
我知道這是這樣的,但我怎麼知道什麼是Spotify的在AppStore上的聯繫? – user3783005
谷歌搜索:https://itunes.apple.com/us/app/spotify-music/id324684580?mt=8 –
而不是使用'openURL'到iTunes中的鏈接,你應該使用'SKStoreProductViewController'。 – rmaddy