0

iv created an app but id like to add a feature where when i press a button it opens my spotify app and automatically plays music... if this is even possible that is... iv got most of it done i think, iv got the button and it opens spotify but cant find out how to auto play, has anyone done this or knows how to?

-(IBAction)spotify:(id)sender {

NSString *stringURL = @"spotify:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
}

please help :)

bob53
  • 11
  • 2
  • iOS sandboxing mechanism makes it impossible for one app to access another. So I don't think you can do more things after launching another app. – Ben Lu Jan 28 '13 at 21:01
  • I think this can help you: http://stackoverflow.com/questions/10111848/opening-spotify-app-from-my-iphone-app – Matthias Nagel Jan 28 '13 at 21:23

1 Answers1

1

You can open most spotify: URLs (using [[UIApplication sharedApplication] openURL:];) and the Spotify iOS client will open and show them.

There's some documentation here - make sure you use spotify: URIs and not HTTP URLs.

However, the iOS client currently doesn't support autoplay that I'm aware of - it'll be up to the user to push play.

Alternatively, you could use CocoaLibSpotify to embed Spotify playback right inside your app.

iKenndac
  • 18,730
  • 3
  • 35
  • 51