Search code examples
iossearchyoutube

iOS open YouTube App with query (url schemes)


Is there an URL Scheme to open the YouTube iOS app with a specified search query?

I tried:

NSString *stringURL = @"http://www.youtube.com/results?search_query=foo";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

But this will open Safari instead of the YouTube Application.


Solution

  • You can't use this http://www.youtube.com/results?search_query=foo for opening youtube app. If you use the above url it'll open the safari instead of youtube app.

    There are only three URLSchemes available for opening youtube app:

    • http://www.youtube.com/watch?v=VIDEO_IDENTIFIER
    • http://www.youtube.com/v/VIDEO_IDENTIFIER
    • youtube://

    Reference: iPhoneURLScheme