Making phone calls on the iPhone
Try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8005551212"]];
... which will bring up a dialog in which your users will confirm the call.
iOS making a phone call from the app without a confirmation alert
Unfortunately, what you desire to do is not possible, at least in the existing versions of iOS. That dialog will always show.
Per Apple's documentation for openURL
:
When a third party application invokes openURL: on a tel://,
facetime://, or facetime-audio:// URL, iOS displays a prompt and
requires user confirmation before dialing.
Making calls on iPhone/iPod/iPad
Every iOS 8 device has the FaceTime App which now provides the power to call anyone your iPhone can call.
It's called continuity
The user has to allow this on his iPhone in Settings.app under "FaceTime" -> "iPhone Cellular Calls"
Making phone calls on the iPhone
Try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8005551212"]];
... which will bring up a dialog in which your users will confirm the call.
Making in-app phone calls on iOS
Nope, to use GSM, it is not possible. You will have to direct that to the dialer. I believe you can develop some sort of solution, if you jailbreak, not sure if that is what you want.
Source: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CoreTelephonyFrameworkReference/_index.html
Make a phone call programmatically
Probably the mymobileNO.titleLabel.text value doesn't include the scheme //
Your code should look like this:
ObjectiveC
NSString *phoneNumber = [@"tel://" stringByAppendingString:mymobileNO.titleLabel.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
Swift
if let url = URL(string: "tel://\(mymobileNO.titleLabel.text))") {
UIApplication.shared.open(url)
}
Making a phone call in an iOS application
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.
IOS How to make phone call with nondigits
I wanted to do this, too. There's no way. It's explicitly disallowed by Apple for security reasons:
To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone application supports most, but not all, of the special characters in the
tel
scheme. Specifically, if a URL contains the*
or#
characters, the Phone application does not attempt to dial the corresponding phone number.
Source:
- Apple URL Scheme Reference: Phone Links
Related Topics
How to Cancel Usernotifications
Secure Contents in Documents Directory
In-App Purchase Sandbox Environment Loop
How to Register Undomanager in Swift
Sprite Kit Sprites Loading Performance Improvement
Xcode /Podfile.Lock: No Such File
iOS Ibeacon: How to Get All of Proximityuuid Programmatically
iOS Appextension:How to Combine Nsextensionactivationrule and Nspredicate
Module Compiled with Swift 5.0.1 Cannot Be Imported by the Swift 5.1 Compiler
Canopenurl Not Working in iOS 10
Confirm Back Button on Uinavigationcontroller
Best Method to Store Data for an iOS App
Changing Uipageviewcontroller's Page Programmatically Doesn't Update the Uipagecontrol
Swift - Add Gesture Recognizer to Object in Table Cell
Taking Photo with Custom Camera Swift 3
iOS 13 Set Uisearchtextfield Placeholder Color
Fbsdkaccesstoken Currentaccesstoken Is Not Being Updated After Log In
Why Is a Https Nsurlsession Connection Only Challenged Once Per Domain