iPhone 4 problems dialing from inside app - iphone

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

Related

Calling other facetime emails in iOS

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

How to open iphone mail application from my own application?

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.

sending message to pre configured numbers

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

FaceTime iPhone

NSURL *url = [NSURL URLWithString:#"facetime://+123456789"];
[[UIApplication sharedApplication] openURL:url];
In the above code "123456789" is a inbuilt iPhone no or our own phone number?
Thanks,
Vadivel
It's the phone number that you want call.

How to open Maps app from my code to show directions?

HI.. I have to show directions between two coordinates. I'd like to open Maps app, passing the start and end coordinates from my code.
I don't want to open it in the Google maps, which opens in browser(Safari). I tried that method. That was working perfect.
NSString* urlStr = [NSString stringWithFormat: #"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", s_lat, s_long, d_lat, d_long];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:urlStr]];
But, I want to open iPhone Maps app. How can i do this? Is this possible? Any help will be appreciated.
Try it on a real device. I'm using the same code and it opens Safari at the simulator and iPhone Maps at the device.
Hey Simon the method you are using is
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:urlStr]];
will only open safari.So there is no chance that with open url you would open a diiferent thing.You can use the UIWebView for this and then load the webview with the url.I think that would be the simple thing like this
views=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
[views setBackgroundColor:[UIColor lightGrayColor]];
NSString* urlStr = [NSString stringWithFormat: #"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", s_lat, s_long, d_lat, d_long];
NSURL *url=[NSURL URLWithString:urlStr];
NSURLRequest *req=[NSURLRequest requestWithURL:url];
//[views loadHTMLString:googlePage baseURL:requestURL];
[views loadRequest:req];
self.view=views;
And if you even don't want to use this then then you can use the MapKit provided in your XCode Frameworks.Hope this would help you.