SMS body in iphone SDK - iphone

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.

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 the Phone (Call) with a button and a Text field/View (iPhone) and come back to the application back

Hello, I have successfully developed an application in which clicking on UIButton the Mobile no in UITextField dialled.
But I am not able to come back in my application. Is it possible to come back on the page from which I have dialled the Mobile number.
-(void)newuser:(id)sender;
{
NSString *URLString = [#"tel://" stringByAppendingString:#")172-123456"];
NSURL *URL = [NSURL URLWithString:URLString];
[[UIApplication sharedApplication] openURL:URL];
}
Thanks
No, an application receiving a URL to process doesn't get information about the sender. Besides, as far as I know the Phone application doesn't have a Back button either.
not sure which iOS version this was implemented in but I use this simple approach in my latest app 'App Time' which is to launch the call from within a UIWebview, but doesn't require anything more than...
UIWebView *webView = [[UIWebView alloc] init];
NSURL *telURL = [NSURL URLWithString:#tel://yourNumber"];
[webView loadRequest:[NSURLRequest requestWithURL:telURL]];
the user is prompted to confirm the call with a UIAlertview but will be brought back to the same screen after the call completes.

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.

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