How do you launch a youtube video from within an iPad app? - iphone

How do you launch a youtube video from within an iPad app?

NSString *stringURL = #"/*your youtube video URL/*";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Related

open pdf in to another pdfviewer application from my application

I have one pdf in my application and I want to open that pdf but not in my applicaton.
When ever i'll click or open that pdf it will ask me to open that pdf in another application of pdf viewer availbale on my device i wnt to know that is it possible & if possible how can i do that?
-Thanx in advance
You need to use only apple PDF viewer afaik. I dont know if I am wrong here. (Please correct me in this case)
To open PDF in iBook app, use this code
NSString *stringURL = #"itms-books:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
NSString *stringURL = #"itms-bookss:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Open Documents from iBooks in my application

Is it possible to open a document from iBooks in my application? I found only that:
NSString *stringURL = #"itms-books:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
but with this I can only open iBooks from my application.
No that is not possible, there is no API to get document from iBooks.

how to open itunes link in iphone app?

I am trying to open itunes link on UIControlEventTouchDown button press event. My code is as follows.
NSString *urlString =#"http://itunes.apple.com/in/album/carnatic-vocal-sanjay-subrahmanyan/id106924807?ign-mpt=uo%3D4";
NSString *str_ur=[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url=[NSURL URLWithString:str_ur];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webview_buy loadRequest:requestObj];
webview_buy.delegate=self;
[self.view addSubview:webview_buy];
This will go to itunes in the device and open the itunes store. But i get an alert message that says
Your Request could not be Completed.
Please give idea with code.
First copy the url from iTunes which you want to open in app.
Then use below code:
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:#"http://itunes.apple.com/in/album/carnatic-vocal-sanjay-subrahmanyan/id106924807?ign-mpt=uo%3D4"]];
here, URLWithString value will be your app url which you want to open.
Let me know in case of any difficulty.
Use the itms-apps:// prefix to open in iTunes, e.g.
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:#"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=409954448"]];
It will work only with device. Throws Request could not be completed on simulator.

Iphone: how to launch a route in google maps api from your application

I have read a lot of topics, but i don't find when i want
I want to launch google map api from my application with that:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"]]
But it's open safari with Google maps page. I want open Google map API with my route. There is a maps:// or other things?
Thanks for help !!!
Try this
UIApplication *app = [UIApplication sharedApplication];
NSURL *url = [[NSURL alloc] initWithString: #"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"];
[app openURL:url];
[url release];
have a look at the Apple URL Scheme Reference for MapLinks
Edit: your URL looks correct. Looks like you are testing on Simulator! GoogleMaps app is only available on device!
Try this
NSString *urlstring=[NSString stringWithFormat:#"http://maps.google.com/?&saddr=%# &daddr=%#",sourceaddress,destinationaddress];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

SMS body in iphone SDK

I need to send an SMS from my iphone app. the body of the SMS is created programatically. so when i tap on a button the SMS application should get opened with my message pre-typed in it. anybody knows how to do it? need help
Thanks in advance.
Shibin
You can't set the SMS body. The only things you can do from your code, as per the official SDK, is 1) to open the SMS application:
NSString *stringURL = #"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
and 2) to set the phone number for a new message:
NSString *stringURL = #"sms:+12345678901";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
You can set the body in iOS 4. Please cf the documentation.