open pdf in to another pdfviewer application from my application - iphone

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];

Related

How to register an app to respond to a custom URL scheme opening request?

Like this:
NSString *stringURL = #"appname://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
I slightly remember it was necessary to write a value-key to Info.plist. How?
Add this to plist .
The app will by called by #"readtext://" url
This seems to be the question that I answered (with screenshots & source code) here.
And I've posted a full walkthrough of how to do this on my blog.

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.

Send PDF to iBooks

Now iBooks supports PDF. My app has access to many PDF files. Is it possible to send PDFs to iBooks (or other PDF readers like GoodReader and iAnnotate PDF) from my app?
//get path to file you want to open
NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:#"readme" ofType:#"pdf"];
//create NSURL to that path
NSURL *url = [NSURL fileURLWithPath:fileToOpen];
//use the UIDocInteractionController API to get list of devices that support the file type
docController = [UIDocumentInteractionController interactionControllerWithURL:url];
[docController retain];
//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file.
BOOL isValid = [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
To answer my own question - yes, you can send a PDF to apps supporting custom URL scheme using this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
URL scheme for GoodReader is:
url=#"ghttp://www.mysite.com/myfile.pdf";
iAnnotate PDF is:
url=#"pdfs://www.mysite.com/myfile.pdf";
Does anyone know the custom URL scheme for iBooks?
Use this link to find the url schemes http://schemes.zwapp.com/
and use [[UIApplication sharedApplication] openURL:url];
to launch in that application.
thanks

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.