0

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?

user2414460
  • 211
  • 3
  • 14
  • Have you checked that `contactNumber` is enabled for Facetime as written? I'm assuming from the variable name that it is a phone number, but the other person might have Facetime enabled for an e-mail address or the number could be missing country codes, etc? – Arkku Nov 18 '13 at 10:57
  • Could you NSLog the contactNumber and post the results. – Nikos M. Nov 18 '13 at 10:57
  • Well, I copied the `[[UIApplication sharedApplication] openURL:[NSURL URLWithString:facetimeString]]; ` and there was written i should put a phone number after FaceTime://. The NSLog("%s",contactNumber); : 2013-11-18 12:04:55.553 VideoSms[367:60b] +4917656... – user2414460 Nov 18 '13 at 11:18
  • I think you should [check this](http://stackoverflow.com/questions/13768869/launching-facetime-from-your-app) before moving ahead. People have reported appstore rejection of app using `facetime://` url. – Amar Nov 18 '13 at 11:26
  • I've already seen that but thanks for the warning. – user2414460 Nov 18 '13 at 11:27
  • try to remove all spaces from number, If not working then try to remove special character – Shourob Datta Aug 05 '21 at 08:32

2 Answers2

0

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.

Black Frog
  • 11,595
  • 1
  • 35
  • 66
0

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];

Shrikant Phadke
  • 358
  • 2
  • 11