Open Link on Twitter App IOS

浪尽此生 提交于 2019-12-23 02:56:45

问题


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?


回答1:


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.




回答2:


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

From iPhone URL Schemes.



来源:https://stackoverflow.com/questions/30794552/open-link-on-twitter-app-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!