ios - How to redirect url to either the Soundcloud or youtube app if downloaded -


So when I want to go to the Twitter app, if the user has downloaded it and is a Safari (a browser) No. I write this code:

  NSURL * urlApp = [NSURL URLWithString: [NSString stringWithFormat: @ "% @", @ "Twitter: // user? Screen_name = foo"]] ;; If ([[UIApplication is shared applicant] canOpenURL: urlApp]) [[UIApplication shared application] Open URL: urlApp]; } Other {[UIApplication shared application] Open URL: [NSL URL URLString: @ "https://www.twitter.com/foo"]]; }  

If I want to do this with Facebook, then I have to do this:

  [[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ " Https:]] //www.facebook.com/TragicClothing ";  

But what happens when I want to do it with Soundcloud (and YouTube)?

Is there an equivalent twitter: // user? Screen_name = foo for both of them?

Please keep in mind that I want to go to Soundcloud (and YouTube) user page ( foo )


My code for YouTube:

  NSString * channelName = @ "Channel"; NSURL * linkToAppURL = [NSURL URLWithString: [NSString stringWithFormat: @ "youtube: // user /% @", channel name]]; NSURL * linkToWebURL = [NSURL URLWithString: [NSString stringWithFormat: @ "http://www.youtube.com/user/%@", channelname]]; If you can open the YouTube app url ([[UIApplication shared application] canOpenURL: linkToAppURL]) // Launch YouTube app with this url [[UIPPCISION Shared Application] Open URL: LinkToop URL]; } Else {// youtube app can not open url, so instead of the safari can be launched [[UIPPicipation Shared Episode] Open URL: Link toweb]; } This is the correct mode to open the app and check whether it is installed:  

If you have a text field or label that you want to use:

  NSString * tweetUser; TweetUser = self.myLabel.text; [[UIApplication shared application] Opal: [NSL URL URL Strength: [NSSTING string with format: "" Twitter: // user? Screen_name =% @ ", twitter user]]] ;;  

The correct method is:

  - (IBAction) Tweet: (ID) sender {if ([UIApplication is shared application] canOpenURL: [NSURL URLWithString: @ "Twitter: // app"]]) [[[UIPPixement ShareApp] Open URL: [NSL URL URL Strength: @ "Twitter: // user? Screen_name = "]] ;; } And {{no self-supplied alarm}; }} - (UIAlertView *) No Installed {Return [[UIAlertView alloc] initWithTitle: @ "Twitter is not installed!" Message: @ "Open the app should be installed on the device on twitter" Representative: cancel the vacanion title: @ "OK" other button titles: zero]; }  

For example, YouTube is:

  if ([[UIApplication is a partial application] canOpenURL: [NSURL URLWithString: @ "youtube: // App "]]) {[UIApplication shared application] Opal: [NSD URL URL string: @" youtube: // user / donterracks "]];  

This is a sound-cloud, but you do not want the name of the user ID:

  if ([[UIApplication is a part of the application] canOpenURL: [NSURL URLWithString: @ "soundcloud: // app"]]) [[UIApplication shared application] Open URL: [NSL URL Youthhostring: @ "Sound Cloud: User: ID"]];  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -