Call from ios app with Pause - ios

I am working with VOIP application. I am trying to make call from my ios app which contains Pauses indicated with (,).
NSString *phoneNumber = [#"telprompt://" stringByAppendingString:finalNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
On dialling number, call is not connected. What I can use to allow pause in my number.

Try using tel:// scheme:
Objective-C
NSString *telUrl = [NSString stringWithFormat:#"tel://%#,%#", contactPhone, contactExtension];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telUrl]];
Swift
let formattedPhone = "tel://\(contactPhone),\(contactExtension)"
if let phoneURL = NSURL(string:formattedPhone) {
print(phoneURL)
UIApplication.sharedApplication().openURL(phoneURL)
}
And make sure your string doesn't have white spaces.
Cheers.

Related

Skype URI doesn't work on new version Skype in iOS

I have developed one application which use Skype URI for dial the tel number.
NSString* stringURL = [NSString stringWithFormat:#"skype:%#", strTel];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:stringURL]];
But the Skype URI doesn't work.
I remembered it worked before.
Now, it only opened Skype, and nothing happens (It used to dial the tel number before).
I checked the skype document, but seems nothing change.
Did I miss anything?
Please help me to solve this issue.
PS: I already added the key LSApplicationQueriesSchemes in Info.plist file for skype
Firsly check skype is in your device or not. You can use below code for Skype and check real device.
BOOL skypeInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(skypeInstalled){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"skype:echo123?call"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/in/app/skype/id304878510?mt=8"]];
}
Or Use as this
NSString* urlString = [NSString stringWithFormat:#"skype:USER_NAME?call"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: urlString]];

How to Open Keyboard's settings screen programmatically in iOS 10?

How to Open Keyboard's settings screen programmatically in iOS 10?
This code is not working in iOS 10
NSURL *keyboardSettingsURL = [NSURL URLWithString: #"prefs:root=General&path=Keyboard/KEYBOARDS"];
[[UIApplication sharedApplication] openURL:keyboardSettingsURL];
and added URL Scheme
It looks like this functionality has been disabled in iOS 10. I believe that https://developer.apple.com/library/content/qa/qa1924/_index.html is no longer valid. I checked several top keyboard apps and they have either been updated to no longer have a direct link to the preferences, or have a non-working button.
is work in iOS 10+
NSURL *keboardURL = [NSURL URLWithString: #"App-Prefs:root=General&path=Keyboard/KEYBOARDS"];
[[UIApplication sharedApplication] openURL:keyboardURL];
key points:
#"App-Prefs:root=General&path=Keyboard/KEYBOARDS"
You may need to add a URL Scheme to your project if you haven't already. Instructions and more details can be found at this Apple Q&A Reference. Hope this helps!
In iOS 10, a new url is required. Try using this code which tests both urls :
NSArray* urlStrings = #[#"prefs:root=General&path=Keyboard/KEYBOARDS", #"App-Prefs:root=General&path=Keyboard/KEYBOARDS"];
for(NSString* urlString in urlStrings){
NSURL* url = [NSURL URLWithString:urlString];
if([[UIApplication sharedApplication] canOpenURL:url]){
[[UIApplication sharedApplication] openURL:url];
break;
}
}
For IOS-10 or higher,openURL is deprecated. use with completion handler like below.
NSString *settingsUrl= #"App-Prefs:root=General&path=Keyboard";
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0){
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:settingsUrl]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:settingsUrl] options:#{} completionHandler:nil];
}
}

telprompt without alert

My app need to dial a number and I know that telprompt return back to app after dial. But it will alert user every time want to call a number, is there any way to direct call number without show a alert view?
you can make a call using bellow code:-
NSString *value =#"9999999999";//your telnumber
NSURL *url = [[ NSURL alloc ] initWithString:[NSString stringWithFormat:#"tel://%#",value]];
NSLog(#"currunt number%#",url);
[[UIApplication sharedApplication] openURL:url];
hope this will help little more
tel directly call the given number without confirmation and did not return to application after call finishes so instead of it , you may use telprompt.
PhoneNumber=#"999999999";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"telprompt://%#", PhoneNumber]]];

alternative to openUrl for sms and calling

Is this is the only way to open a dialer to call or msg.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:+%#",phoneNumber]]];
if yes. then will this support from ios3 to ios6 (beta).
if no. then can any one please give some sample code.(if any private api can do this pls mention it)
if separate functions are available for sending sms and calling a number, please let me know that too.
in ipad 1 with ios 4.2.6, the following codes are not working
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"sms:9190432097420"]]];
and
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:9190432097420"]]]
Wr does the problem lies
According to UIApplication's Class Reference, the openUrl: method is available in iOS 2.0 and later. So you should be safe to use that method.
With regard to your example, it's 'safer' if you first check if there is an application that can handle the provided url. For instance:
NSURL *url = [NSURL URLWithString:#"tel:9190432097420"];
if([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
else {
NSLog(#"No application for url '%#'", url);
}
Are you testing on an actual device or in the simulator? The simulator does not support this as far as I've seen.

Making a phone call in an iOS application

I have some code which attempts to make a call within an application, but it doesn't seem to be working:
UIApplication *myApp = [UIApplication sharedApplication];
NSString *theCall = [NSString stringWithFormat:#"tel://%#",phone];
NSLog(#"making call with %#",theCall);
[myApp openURL:[NSURL URLWithString:theCall]];
Sometimes, the variable phone is something such as #"(102) 222-2222". How can I make a call with a phone number like this? Do I need to manually extract the numbers out of it and get rid of all the extra punctuation?
Yup. You need to take those out yourself. Or you can use the snippet below...
NSString *cleanedString = [[phoneNumber componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:#"0123456789-+()"] invertedSet]] componentsJoinedByString:#""];
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:#"tel:%#", cleanedString]];
Note: you may be tempted to use -stringByTrimmingCharactersInSet:, but that one only removes characters at the start and the end of the string, not if they appear in the middle.
To go back to original app you can use telprompt:// instead of tel:// - The tell prompt will prompt the user first, but when the call is finished it will go back to your app:
NSString *phoneNumber = [#"telprompt://" stringByAppendingString:mymobileNO.titleLabel.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
just an update on above answer.
Here's a simple method that can be used to make a call and return to the app after the call is finished.
Add the following to your .m file
- (void) dialNumber:(NSString*) number{
number = [#"telprompt://" stringByAppendingString:number];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]];
}
Then add the following code wherever you want to make the call from:
[self dialNumber:#"5031234567"];

Resources