Hai
I am developing a new application. In that send a message to pre configured numbers and the user selecting numbers. How it is possible? when then send button is pressed. Please help. Can any give me some Sample code or tutorial.
Thank You
Please read the below SO post,
How to send SMS and number from contacts?
Here is link could help you ...
http://iosdevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html
SMS
To open the SMS application, just use the sms: protocol in your URL:
NSString *stringURL = #"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
You can specify a phone number, but apparently not a default text for your message:
NSString *stringURL = #"sms:+12345678901";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Related
I would like to call other facetime numbers, but these are emails and not numbers. How do I do it?
For numbers, I know what to use.
NSURL *url = [NSURL URLWithString:#"facetime://+123456789"];
[[UIApplication sharedApplication] openURL:url];
But for emails, how do i change it. Any idea?
NSURL *url = [NSURL URLWithString:#"facetime://email#example.com"];
[[UIApplication sharedApplication] openURL:url];
These are the options
#"facetime://appleId" // For apple id
#"facetime://email#example.com" // For email id
#"facetime://5558675309" // For phone number
There is an iOS 5.0+ app, released in App Store, which displays employees profiles with their phone numbers. The users of the app can tap on the phone number and the number will be dialed on their iPhones.
The problem is that some users with iPhone 4 are reporting that it does NOT dial.
This is the code I am using to dial:
NSString *cleanedString = [[self.member.phone componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:#"0123456789-+()"] invertedSet]] componentsJoinedByString:#""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:#"tel://%#", escapedPhoneNumber]];
[[UIApplication sharedApplication] openURL:urlText];
Any ideas about this?
There shouldn't be any / in the tel: scheme:
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:#"tel:%#", escapedPhoneNumber]];
In the Apple URL Scheme Reference you can see some example for what is allowed in the tel: scheme.
If you use telpromt instead of tel this will return you to app after your call ends|
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt:1234567890"]];
I've a a pdf placed in my Code files. I want it to open in iBooks, while researching I've found this :
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];
How can I use this or what other way i can open my PDF File in iBook?
Regards
Maybe too late but I created a small example where the method explained in andycodes used. I uploaded to Github and you can download it here:
https://github.com/cjimenezpacho/openpdfibooks
Basically is this piece of code in a IBAction and the required delegate methods:
NSURL *url = [[NSBundle mainBundle]
URLForResource: #"iPhoneintro" withExtension:#"pdf"];
self.docController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.docController.delegate = self;
[self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
Links to Apple documentation:
Class:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocumentInteractionController_class/Reference/Reference.html
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"itms-bookss://%#",self.pathToFile]]];
this does open a local pdf to Ibooks needs 2 s's.
Edit: to be specific on this this will open the local PDF if it is in iBooks already locally on the device.
if you need to add it to iBooks so far as I know you need to use the UIDocumentInteractionController.
Take a look at this Tumblr post explaining how do achieve a similar result using UIDocumentInteractionControllers.
http://andycodes.tumblr.com/post/738375724/ios4-sdk-opening-pdfs-in-ibooks
i am working on signup feature. In this feature when the user create account successfully. i am asking him or her to activate his account.
i want to open the mail application of iphone if user say yes.
now my question is simple how to open mail application from my own application?
#define URLEMail #"mailto:sb#sw.com?subject=title&body=content"
NSString *url = [URLEMail stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
Try this out.
-(void)launchMailAppOnDevice
{
NSString *recipients = #"mailto:myemail#gmail.com?subject=subjecthere";
NSString *body = #"&body=bodyHere";
NSString *email = [NSString stringWithFormat:#"%#%#", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}
stringByAddingPercentEscapesUsingEncoding and openURL are deprecated.
Now use this:
#define URLEMail #"mailto:sb#sw.com?subject=title&body=content"
NSString * encodedString = [URLEMail stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
UIApplication *application = [UIApplication sharedApplication];
[application openURL:[NSURL URLWithString: encodedString] options:#{} completionHandler:nil];
Ahoy!
The long and short of it is; you can't.
You can create an email compose view for the purpose of sending emails (see MFMailComposeViewController), but you cannot open applications arbitrarily without a purpose.
See this previous post for clarification: Launch an app from within another (iPhone)
Really though, it's not much effort for the user to close your app and open Mail so I wouldn't worry too much about it anyway.
Currently I am doing this to 'get directions':
NSString *googleMapsURLString;
googleMapsURLString = [NSString stringWithFormat:
#"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f",
curLoc.latitude, // Start
curLoc.longitude,
self.hotspot.coordinate.latitude,
self.hotspot.coordinate.longitude];
NSLog(#"Opening URL: %#",googleMapsURLString);
NSURL *url = [NSURL URLWithString:googleMapsURLString];
[[UIApplication sharedApplication] openURL:url];
Does anyone know if there is a parameter to get directions via walking instead of defaulting to driving?
Just add
dirflg=w
to your parameters.