【Objective-C】TwitterプロフィールページをカスタムURLスキームで呼び出す
TwitterのプロフィールページをiPhoneアプリから呼び出す方法。
(環境:xcode5, iOS7)
・Webブラウザで呼び出す場合
NSURL *url = [NSURL URLWithString:@"https://twitter.com/プロフィール名"];
・公式アプリで呼び出す場合
NSURL *twitterAppURL = [NSURL URLWithString:@"twitter://user?screen_name=プロフィール名"];
上記の後、以下のようしてアプリを起動
UIApplication* app = [UIApplication sharedApplication]; if([app canOpenURL: twitterAppURL]) { [app openURL: twitterAppURL]; } else { [app openURL: url]; } [[UIApplication sharedApplication] openURL:url];