Can't use FaceTime from app - ios

I'm writing an App where you can call a person via FaceTime. My problem is, when I click on my button for the FaceTime-call, FaceTime opens but there is always a message "animStartXXXXXXX is not available for FaceTime." (the XXXX are random numbers). If I then call the same person from the normal FaceTime-app it works.
The code for the FaceTime-call:
NSString *facetimeString = #"facetime://";
[facetimeString stringByAppendingString:contactNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:facetimeString]];
I get the contactNumber by selecting it from the Adressbook from within my App and it works fine with normal calls/SMS.
Does anyone have a solution for my problem?

I don't think PAIR is using FaceTime for video chat.
Since FaceTime API is not available to developers, you should consider using OpenTok iOS SDK.
Here is a excerpt from GitHub site:
The OpenTok iOS SDK lets you use OpenTok video sessions in apps you build for iPad, iPhone, and iPod touch devices. This means you can use OpenTok video sessions that connect iOS users with each other and with web clients.

It is official that you can use Native app URL strings for FaceTime video calls:
facetime:// 14085551234
facetime://user#example.com
Please refer to the link: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/FacetimeLinks/FacetimeLinks.html
Though this feature is supported on all devices, you have to change the code a little bit for iOS 10.0 and above as openURL(_:) is deprecated.
https://developer.apple.com/documentation/uikit/uiapplication/1622961-openurl?language=objc
Please refer code below for the current and fallback mechanism, so this way it will not get rejected by Appstore.
-(void) callFaceTime : (NSString *) contactNumber
{
NSURL *URL = [NSURL URLWithString:[NSString
stringWithFormat:#"facetime://%#", contactNumber]];
if (#available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:URL options:#{}
completionHandler:^(BOOL success)
{
if (success){
NSLog(#"inside success");
}
else{
NSLog(#"error");
}
}];
}
else {
// Fallback on earlier versions
NSString *faceTimeUrlScheme = [#"facetime://"
stringByAppendingString:contactNumber];
NSURL *facetimeURL = [NSURL URLWithString:faceTimeUrlScheme];
// Facetime is available or not
if ([[UIApplication sharedApplication] canOpenURL:facetimeURL])
{
[[UIApplication sharedApplication] openURL:facetimeURL];
}
else
{
// Facetime not available
NSLog(#"Facetime not available");
}
}
}
in contactNumber either pass phone number or appleid.
NSString *phoneNumber = #"9999999999";
NSString *appleId = #"abc#gmail.com";
[self callFaceTime:appleId];
objective-c ios facetime

Related

can you force ios to launch safari other than any other browser or even give an option?

Is there a way to launch safari only? I know in order to send an intent and have ios to handle it we can do [[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://"]];, but if user has other browser installed (i.e. chrome), there's no guarantee safari will be used.
Reason I want to use safari is that I'm trying to have safari to handle certificate authentication for me, and according to here, only system app has permission to do so
try this
//initially we need to check safari is installed or not in our device
NSURL *url = [NSURL URLWithString:#"safari://"];
UIApplication *application = [UIApplication sharedApplication];
if ([application canOpenURL:url]) {
// if success again need to validate the our calling URL.
NSURL *linkURL = [NSURL URLWithString:#"https://iostree.wordpress.com/2017/07/29/launch-safari-from-ios-app/"];
if ([application canOpenURL:linkURL]) {
if ([application respondsToSelector:#selector(openURL:options:completionHandler:)]) {
[application openURL:linkURL options:#{}
completionHandler:^(BOOL success) {
NSLog(#"success");
}];
}
}
}else{
NSLog(#"safari is not installed");
}

Are we allowed to programmatically open iOS WiFi settings in iOS 10? [duplicate]

I was using prefs:root=WIFI url scheme in my app with prefs entered in info.plist to open directly the iOS settings application in Wi-Fi settings and it was working great on iOS 9 but it does not work anymore on iOS 10.
Does anyone know if this is just a regression in the first developer preview or the way to open Wi-Fi settings has changed in iOS 10 or it is not allowed anymore?
Just so it's explicit: Apple does not allow this. It's possible your app will make it through anyway, but this is the same as using any other undocumented API.
Here is the full list of supported Apple URL schemes.
Here's a thread where Apple confirms that "any Apple URL schemes that are not officially documented should be considered private API."
SWIFT 3.0:- working in iOS 10
#IBAction func openWifiSetting(_ sender: AnyObject) {
let url = URL(string: "App-Prefs:root=WIFI") //for WIFI setting app
UIApplication.shared.openURL(url!)
}
My app is also using that api. Unfortunately apple disable this on iOS 10. Here's my solution: below iOS 10, it can still open Setting App. on iOS 10, it will go to a subpage(Cellular Data access) of Setting App, you can back to setting page by one click. I decide to keep it. because it's still convenient than user manually open Setting App.
NSURL *url = [NSURL URLWithString:#"prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
try this for objective c in iOS 10
NSURL *url = [NSURL URLWithString:#"prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=WIFI"]];
}
Using "App-Prefs:root" instead of "prefs:root"
iOS 10, to open your apps settings:
if let settingsURL = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.openURL(settingsURL)
}
This works fine on iOS 10,
Go to Targets --> (Application) --> Info --> URL Types --> +
In the URL Schemes write
prefs
Then Call,
- (void)openWifiSettings
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"prefs:root=WIFI"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=WIFI"]];
}
}

Facebook account which isn't mine

My facebook is sorted like this
- (IBAction)fb:(id)sender {
NSURL *facebookURL = [NSURL URLWithString:#"fb://notes/Nike"];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL])
{
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://facebook.com"]]; }
}
The problem is, I have an account on facebook application but I wanted it to go to another fb account which is the "Nike" .. it's not!
I checked before this and tried them all, no use
fb://profile – Open Facebook app to the user’s profile
fb://friends – Open Facebook app to the friends list
fb://notifications – Open Facebook app to the notifications list
fb://feed – Open Facebook app to the News Feed
fb://events – Open Facebook app to the Events page
fb://requests – Open Facebook app to the Requests list
fb://notes – Open Facebook app to the Notes page
fb://albums – Open Facebook app to Photo Albums list
Can anybody help?
EDITED
ADDED
- (IBAction)fb:(id)sender {
NSURL *fbURLWeb = [[NSURL alloc] initWithString:#"https://www.facebook.com/nike"];
NSURL *fbURLId = [[NSURL alloc] initWithString:#"fb://profile/15087023444"];
// Check if FB app is installed
if ([[UIApplication sharedApplication] canOpenURL:fbURLId]) {
// If the FB app is installed
[[UIApplication sharedApplication] openURL:fbURLId];
} else {
[[UIApplication sharedApplication] openURL:fbURLWeb];
}
}

Call is not going from my ios app to Skype

Hi i am new for Ios app in my project i have added the facility for user make call from ios app to skype
for this i have installed skype in my device and when i made call call from my app call not going
What I have tried so far is the following:
NSString * userNameString = #"sarithasai";
NSString* urlString = [NSString stringWithFormat:#";skype://%#?call", userNameString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
According to the Skype URI tutorial: iOS apps by MSDN your schema is wrong. You should probably use the following instead:
NSString *urlString = [NSString stringWithFormat:#"skype:%#?call", userNameString];
Note that you should check wether or not Skype is installed beforehand which is mentioned in the linked article as well.
To start a chat use the schema
skype:user?chat
To start a video call use
skype:user?call&video=true
Try this code,
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?call", userNameString]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.com/apps/skype/skype"]];
}
for more detail follow here.

Dial a phone number with an access code programmatically in iOS

How can I dial a phone number that includes a number and access code programmatically in iOS?
For example:
number: 900-3440-567
Access Code: 65445
UIDevice *device = [UIDevice currentDevice];
if ([[device model] isEqualToString:#"iPhone"] ) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:130-032-2837"]]];
} else {
UIAlertView *notPermitted=[[UIAlertView alloc] initWithTitle:#"Alert" message:#"Your device doesn't support this feature." delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[notPermitted show];
[notPermitted release];
}
follow the tutorial
http://www.makebetterthings.com/blogs/iphone/open-phone-sms-email-map-and-browser-apps-in-iphone-sdk/
to call a number use -
NSURL *url = [NSURL URLWithString:#"tel://012-4325-234"];
[[UIApplication sharedApplication] openURL:url];
to open your app after call finished use -
(Note: telprompt is undocumented)
NSURL *url = [NSURL URLWithString:#"telprompt://012-4325-234"];
[[UIApplication sharedApplication] openURL:url];
You can programmatically dial phone numbers using UIApplication's openURL: method (see example below). I'm unsure if access codes are supported, but this is at least a starting point.
NSURL *URL = [NSURL URLWithString:#"tel://900-3440-567"];
[[UIApplication sharedApplication] openURL:URL];
Edit: See the Apple URL Scheme Reference and the UIApplication Class Reference for more information.
I don't know if you actually found a solution for passing the access code, but for me this code worked:
NSString *dialstring = [[NSString alloc] initWithFormat:#"tel:your_phonenumber,your_accessnumber"];
That will result in a dial string with the following values:
tel:9003440567,65445
The remaining parts are managed by the phone app of iOS with the following command:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dialstring]];
The , in the string causes a pause in your telephonesystem (the one where you want to access a conference room) right after the first number is dialed and a connection is established. So the telephonesystem has time to ask you for the access code (I think it should ask you, that's the way our system works). And after that your access code should be passed.
BE AWARE: Your access code will be passed in in a non-secret way. For example: Your shown access code will be displayed in the iPhone phone app display this way: 9003440567, 65445
Using this user can redirect on Call and after the call he/she will automatically redirected to the app. It's working for me and sure about it.
if ([[device model] isEqualToString:#"iPhone"] ) {
NSString *phoneNumber = [#"telprompt://" stringByAppendingString:cellNameStr];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
} else {
UIAlertView *warning =[[UIAlertView alloc] initWithTitle:#"Alert" message:#"Your device doesn't support this feature." delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[warning show];
}
Here is a self-contained solution in Swift:
private func callNumber(phoneNumber:String) {
if let phoneCallURL:NSURL = NSURL(string: "tel://\(phoneNumber)") {
let application:UIApplication = UIApplication.sharedApplication()
if (application.canOpenURL(phoneCallURL)) {
application.openURL(phoneCallURL);
}
}
}
Now you should be able to use callNumber("7178881234") to make a call; hope this helps!
You can use Phone urls to invoke the Phone application to dial a number for you. See this reference.
The downside is that once the call is finished, user will endup in the Phone application. But I am afraid there is no solution to that problem. iOS doesn't allow any application to directly initiate a call because of security and privacy reasons.
You can use comma for introducing pause(s) while dialing a number.
It's not possible to dial programmatically a phone number that includes number and access code.
The Apple Developer Library gives the following info:
"...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."
See: Apple URL Scheme Reference
There are a number of ways to dial a phone number and the way described that uses:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:555-555-5555"]
Is a valid way to do this however it has a number of issues. First it doesn't properly prompt the user and secondly it doesn't bring the user back to the application when the phone call is completed. To properly place a phone call you should both prompt before the call so you don't surprise the user and you should bring the user back to the application once the call is done.
Both of these can be accomplished without using a private API as is suggested by some of the answers here. The recommended approach uses the telprompt api but it doesn't use the private instantiation of the call and instead creates a web view allowing for future compatibility.
+ (void)callWithString:(NSString *)phoneString
{
[self callWithURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:%#",phoneString]]];
}
+ (void)callWithURL:(NSURL *)url
{
static UIWebView *webView = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
webView = [UIWebView new];
});
[webView loadRequest:[NSURLRequest requestWithURL:url]];
}
A sample project and additional information is provided here:
http://www.raizlabs.com/dev/2014/04/getting-the-best-behavior-from-phone-call-requests-using-tel-in-an-ios-app/
Swift 5.0:
In case someone needed an updated swift code:
private func callNumber(phoneNumber:String) {
if let phoneCallURL:NSURL = NSURL(string: "tel://\(phoneNumber)") {
let application:UIApplication = UIApplication.shared
if (application.canOpenURL(phoneCallURL as URL)) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(phoneCallURL as URL)
} else {
UIApplication.shared.openURL(phoneCallURL as URL)
}
}
}
}

Resources