0

I am trying to open from my app Apple Music app using UIApplication.sharedApplication().openURL and search for an artist or having a link opening a related page where the song is.

Is there an api I can use to search on the Apple Music App? Is this possible?

let test = "https://itun.es/gb/RJEL2?i=915794180"
UIApplication.sharedApplication().openURL(NSURL(string:test)!)

If I use that link the app opens up but nothing happens.

Kara
  • 6,115
  • 16
  • 50
  • 57
SNos
  • 3,430
  • 5
  • 42
  • 92

1 Answers1

0

If

let test = "https://itun.es/gb/RJEL2?i=915794180"

contains your search information you can get the contents of the url like such

let Session = NSURLSession.SharedSession()
var task = Session.dataTaskWithURL(test, completionHandler: {
   (data, response, error) -> Void in

   :
})
task.resume()
Ajwhiteway
  • 986
  • 1
  • 9
  • 23
  • The `data` variable would contain the response of the server from your URL request as NSData. You can turn this into a string using `NSString(data: data, encoding: NSUTF8StringEncoding)`. – Ajwhiteway Jan 21 '16 at 11:58