iPhone 4 problems dialing from inside app

154 Views Asked by At

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?

2

There are 2 best solutions below

0
On

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.

3
On

If you use telpromt instead of tel this will return you to app after your call ends|

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt:1234567890"]];