【问题标题】:Make a FaceTime audio call from my app从我的应用程序进行 FaceTime 音频通话
【发布时间】:2014-06-23 04:10:09
【问题描述】:

我有一个与 FaceTime 帐户相关联的电话号码或电子邮件地址,如何从我的应用程序中发起 FaceTime 音频通话?

【问题讨论】:

    标签: ios ios7 facetime


    【解决方案1】:

    原来 url 方案是 facetime-audio://

    感谢上述回复,但该 url 方案适用于 FaceTime 视频,而不是要求的音频。

    【讨论】:

      【解决方案2】:

      您可以为此使用 Apple 的 Facetime URL Scheme

      网址方案:

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

      代码:

      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
      }
      

      【讨论】:

        【解决方案3】:

        FaceTime 音频通话的原生应用 URL 字符串(仅限 iPhone 到 iPhone 通话):

        facetime-audio:// 14085551234
        facetime-audio://user@example.com
        

        请参考链接:https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/FacetimeLinks/FacetimeLinks.html

        虽然所有设备都支持此功能,但您必须对 iOS 10.0 及更高版本的代码稍作更改,因为不推荐使用 openURL:。

        https://developer.apple.com/documentation/uikit/uiapplication/1622961-openurl?language=objc

        当前和回退机制请参考下面的代码,这样就不会被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");
                }
            }
        }
        
         
        

        在 phoneNumber 中,传递电话号码或 appleID。

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

        【讨论】:

          猜你喜欢
          • 2020-09-04
          • 2014-09-27
          • 2023-04-09
          • 1970-01-01
          • 1970-01-01
          • 2018-06-02
          • 1970-01-01
          • 2019-03-23
          • 2020-07-31
          相关资源
          最近更新 更多