Open Link on Twitter App IOS - ios

I have created a mail template on mailchimp. It consists of a twitter link. But an IPad or an IPhone user clicks on the link from his/her mail, the twitter link opens in the browser instead of the twitter app.
This does not happen in Android.
Any workarounds?

If you use a custom URL <a href="twitter://" than other Android/Desktop devices won't be able to open it. Twitter doesn't redirect with standard URLs from Safari and they should. But they do offer a "Open in app" button at the top left.
So if you want you could add two buttons in the email. One specifically for iOS: twitter://status?id=373205208664272897 and one for other devices https://twitter.com/support/status/373205208664272897.
Or you could create a site that reads the user agent of the device than determines which URL to redirect to.
The third option is just leaving it alone given that it's not really such a big issue in the grand scheme.

NSString *stringURL = #"twitter://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
From iPhone URL Schemes.

Related

whatsapp URL Scheme doesn't give control back to app.

I am trying to share a link via Whatsapp and have read many tutorials as well. I am able to share my link successfully but the problem is that user doesn't come back to my app after sharing on whatsapp.
Here is the code I am using to share:
NSString *referralLink = [NSString stringWithFormat:#"some link here"];
NSString *textToSend = [[NSString stringWithFormat:#"whatsapp://send?text=%#",referralLink] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *whatsappURL = [NSURL URLWithString:textToSend];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}
I know that I have to use URL Scheme to achive this and I have used it too. But I am not sure that I am using it in correct way.
Here is the screenshot of my .info file.
Behind the black bar, I have entered the bundle identifier. i.e com.abc.myapp
This is default behavior in iOS, only if the app developer of the app you are calling allows an option to send the user back to calling app will it work.
WhatsApp does not have such a feature and this is therefore not possible.
Also you should not use the whatsapp: url scheme in your apps info.plist. Doing this will make any app calling whatsapp: to open your app.
you should give your own url scheme(a unique identifier), probably your AppName. You are not supposed to use whatsapp
Now IOS 9 Do support the Apps to come back to the app when they are invoking any third party app being called using OpenURL scheme.
You can make a OS version based support at this moment unless you come to minimal support of IOS 9 for your application.

Open Facebook page from iOS game

I'm creating a facebook game and I want to have a button which let user open my facebook page, however, when I open my page url:
https://www.facebook.com/Spiritbomb.co
It just opens the native Facebook app but does not redirect to my page.
I tried this url on Safari and it works just fine.
Anyone experienced with this could help me please?
Try using NSURL
NSUrl *aUrl = [NSURL URLWithString:#"your facebook url"];
[[UIApplication sharedApplication] openURL:url];
I found out that this type of url doesn't work
https://www.facebook.com/Spiritbomb.co
(What I mean by "doesn't work" is that open this URL in an iOS app will only launch the FB native app, but does not redirect you to the desired Page)
You need to find your Facebook Page ID and use this URL: https://www.facebook.com/YOUR_FB_PAGE_ID
In my case, this URL works: https://www.facebook.com/690543054295905
How to find your FB Page ID: Go to your FB Page, click Edit Page -> Update Page Info
Then scroll to the bottom of the page, you'll find your FB page ID there.
Thanks for all the help, guys.

How to add links in device settings for our app?

I have to add my website link in iPad settings for our app. I know how to add simple text but don't know how to add links so that clicking on it safari will open.
Same as done in facebook / twitter app for "learn more about facebook/twitter"
I have checked this url but didn't find how to add URLs.
Write the following code to your action method of setting row/button
NSURL *yourLinkURL = [[NSURL URLWithString: #"https://www.google.co.in" ];
[[UIApplication sharedApplication] openURL: yourLinkURL];
You can't do that with the settings bundle. The only reason Facebook and Twitter have it is because they are more integrated with the system, so they run a special settings bundle that normal developers don't have access to.

Open Facebook app to customer's page?

I'm building an iOS app with the Facebook SDK.
One of the things my customer wants is a button that launches the Facebook app and shows their Facebook page. Is there some way to do this, perhaps using a URL?
Thanks.
iPhone has a bunch of URL schemes such as:
NSURL *url = [NSURL URLWithString:#"fb://<insert function here>"];
[[UIApplication sharedApplication] openURL:url];
Check this site out for more:
http://wiki.akosma.com/IPhone_URL_Schemes#Facebook
Also check out this SO post for more info:
https://stackoverflow.com/a/10416399/738262

iOS url scheme to open specific youtube page in youtube app

Is there anyway to use an iOS URL Scheme to open the YouTube to a particular user's profile I've tried youtube://user/myusername but that did not seem to work.
To open a Youtube page in Youtube app (if it's installed on the device)
you can check whether the device can open the page:
// URL scheme for youtube app
NSString *youtubeURL = #"youtube://www.youtube.com/user/";
// Page name(or channel name)
NSString *youtubePageName = #"YourPageName";
// Check if the device can open in Youtube app or not.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString: [youtubeURL stringByAppendingString:youtubePageName]]]){
// Open in Youtube app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: [youtubeURL stringByAppendingString:youtubePageName]]];
}else{
// If device cannot open in youtube app, open the page in browser.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.youtube.com/user/YourPageName"]];
}
This solution worked for me
iOS 9 edit: Target app's URL scheme must be added to info.plist under LSApplicationQueriesSchemeskey.
Here is a related post: iOS 9 not opening Instagram app with URL SCHEME
This forum post's lack of responses indicates there probably isn't a way to do this currently: YouTube iOS URL Scheme for Channels
But you may be able to request that feature on YouTube's iOS app feedback page. And in the meantime, I'd recommend just linking to users' HTML YouTube pages.
No, few weeks ago I was looking for the same, but i didn't found anything. Instead I've opted for use a UIWebView to show the youtube channel or using the openURL: UIApplication's method to open the channel with Safari.
If you want to save some time, you can use the easy-to-implement TSMiniWebBrowser's control at this Github page.
Here is the youtube Channel Url scheme, try to load it in UIWebView and it will works.
http://m.youtube.com/#/user/channel_name for e.g http://m.youtube.com/#/user/whartonmagazine

Resources