How to open twitter page in twitter app from my iphone app?

后端 未结 5 1794
一向
一向 2021-02-04 01:44

The page I want to open using twitter app:

https://twitter.com/#!/PAGE

To open twitter app I use the following code:



        
5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-04 02:21

    I know its quite a late response to this question and I agree that, Murat's answer is absolutely correct. Simply add a check as follows:

    NSURL *urlApp = [NSURL URLWithString: [NSString stringWithFormat:@"%@", @"twitter:///user?screen_name=PAGE]];
    
    if ([[UIApplication sharedApplication] canOpenURL:urlApp]){
            [[UIApplication sharedApplication] openURL:urlApp];
        }
    

    I hope this helps someone. Cheers!! :)

提交回复
热议问题