5

I have a phone number or email address associated with a FaceTime account how can I initiate a FaceTime audio call from within my app?

Larme
  • 24,190
  • 6
  • 51
  • 81
user1542125
  • 593
  • 6
  • 16

3 Answers3

5

Turns out the url scheme is facetime-audio://

Thanks for the response above but that url scheme is for FaceTime video, not audio as requested.

user1542125
  • 593
  • 6
  • 16
2

You can use Apple's Facetime URL Scheme for this

URL Schemes:

// by Number
facetime://14085551234

// by Email
facetime://user@example.com

Code :

NSString *faceTimeUrlScheme = [@"facetime://" stringByAppendingString:emailOrPhone];
NSURL    *facetimeURL       = [NSURL URLWithString:ourPath];

// Facetime is available or not
if ([[UIApplication sharedApplication] canOpenURL:facetimeURL])
{
    [[UIApplication sharedApplication] openURL:facetimeURL];
}
else
{
    // Facetime not available
}
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
1

Native app URL strings for FaceTime audio calls (iPhone to iPhone calls only):

facetime-audio:// 14085551234
facetime-audio://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 & above because 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.
        //Below 10.0
        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 phoneNumber, either pass phone number or appleID.

   NSString *phoneNumber = @"9999999999";
   NSString *appleId = @"abc@gmail.com";
   [self callFaceTime:appleId];

Shrikant Phadke
  • 358
  • 2
  • 11