快速入门
更新时间:2025-08-26 08:26:50

YealinkSDK_iOS 集成指南

快速入门

开发准备

本指南概述了如何通过Xcode构建和运⾏应⽤程序。

本指南假设您具备以下条件:

- Xcode 13.4或更⾼版本

- iOS设备(iOS 10或更⾼版本)会议号和会议密码。

- AppId和AppSecret,通过公司技术⽀持⼈员获取。

- YealinkSDK YealinkDemoApp源码 请至 [亿联开发者平台](https://developer.ylyun.com/document/6207)下载

本部分教程演示了如何基于YealinkDemoApp进行快速开发。

备注:

- 暂时不⽀持模拟器运⾏,且仅⽀持arm64设备的运⾏

快速集成

  1. 开始创建项目

  2. 复制YealinkDemoApp源码中的YDPodSpec文件到您的工程目录下:

    image-1

  1. 添加依赖

  2. 在您项目的podfile中添加如下依赖,其中"xxx"为您的项目名称:

    image-2

target 'xxx' do
  use_frameworks!
  pod 'YealinkSDK', :path => '../YDPodspec/'
  pod 'YDAppliction', :path => '../YDPodspec/'
  pod 'YDApi', :path => '../YDPodspec/'
  pod 'YDBasic', :path => '../YDPodspec/'
  pod 'YDBusiness', :path => '../YDPodspec/'
  pod 'YDLogin', :path => '../YDPodspec/'
  pod 'YDCall', :path => '../YDPodspec/'
  pod 'YDResource', :path => '../YDPodspec/'
end
  • 若您的xcode版本为14.0及以上,请添加如下命令到您的podfile文件中:
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
              config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'

              config.build_settings['ENABLE_BITCODE'] = 'NO'

              config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""

              config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"

              config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
    end
end
  1. 执行“pod install”

  2. 进入podfile所在目录下,执行“pod install”命令

  1. 更改项⽬配置以实现SDK兼容性

  2. pod成功之后,请双击工程的.xcworkspace文件进入工程:

    image-3

  3. 如果您使⽤Xcode 11 或更⾼版本构建您的项⽬,SceneDelegates会默认添加到您的项⽬中, SceneDelegates与当前版本的Yealink SDK不兼容 从项⽬导航器中删除SceneDelegate⽂件

  4. 导航到info.plist > Application Scene Manifest并将其删除

    image-4

  5. 请从项⽬导航器中删除SceneDelegate.m和SceneDelegate.h ⽂件。

  6. 导航到项⽬导航器中的AppDelegate⽂件,并删除⽂件中存在的以下UISceneSession 代码

    AppDelegate.m
    
    // If you are using Objective-C, delete the following lines of code from
    
    ![Shape10](RackMultipart20221130-1-8qzmmo_html_4ac9dd6902adc11b.gif)
    
    #pragma mark - UISceneSession lifecycle - (UISceneConfiguration \*)application:(UIApplication \*)application con figurationForConnectingSceneSession:(UISceneSession \*)connectingSceneS ession options:(UISceneConnectionOptions \*)options {
    
    return [[UISceneConfiguration alloc] initWithName:@"Default Configura }
    
    - (void)application:(UIApplication \*)application didDiscardSceneSessio ns:(NSSet\<UISceneSession \*\> \*)sceneSessions {
    
    }
    
  1. 修改项⽬权限

  2. 不⽀持Bitcode,到您的Xcode 项⽬⽂件,选择Project > Build Settings,然后搜索Enable Bitcode选项并将该选项的值设置为No。

    image-5

  3. 在info.plist⽂件中添加以下权限以授予对在iOS设备上运⾏的app所需的摄像头和⻨克⻛的访问权限。导航到info.plist,单击Information Property List旁边的" + "图标,添加请求访问摄像头和麦克风等隐私的字段。

image-6

  • 可参考如下字段:

<key>NSBluetoothPeripheralUsageDescription</key> <string>We will use your Bluetooth to access your Bluetooth headphones.</string>

<key>NSCameraUsageDescription</key> <string>For people to see you during meetings, we need access to your camera.</string>

<key>NSMicrophoneUsageDescription</key> <string>For people to hear you during meetings, we need access to your microphone.</string>

<key>NSPhotoLibraryUsageDescription</key\> <string>For people to share, we need access to your photos.</string\>

  1. 其他配置项

  2. 请根据下图修改相应后台配置:

image-7

  1. 初始化/鉴权准备

  2. 导航到AppDelegate.h⽂件。因为你之前禁⽤了SceneDelagates,添加⼀个 UIWindow到AppDelegate.在AppDelegate.h⽂件中添加以下代码⾏。


 #import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

  • 导航到AppDelegate.m⽂件。您可以使用如下代码覆盖AppDelegate.m文件来处理应用程序的生命周期事件:
#import "AppDelegate.h"
#import <YealinkSDK/YealinkSDK.h>
#import <YDAppliction/YDAppliction.h>

@interface AppDelegate ()

@end

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions {
    return [[YDAppDelegate shareInstance] application:application willFinishLaunchingWithOptions:launchOptions];
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    self.window.rootViewController = [[YDAppDelegate shareInstance] rootViewController];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return [[YDAppDelegate shareInstance] application:application didFinishLaunchingWithOptions:launchOptions];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    [[YDAppDelegate shareInstance] applicationDidEnterBackground:application];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[YDAppDelegate shareInstance] applicationDidBecomeActive:application];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [[YDAppDelegate shareInstance] applicationWillTerminate:application];
}
@end

  1. 运行

  2. 单击Xcode左上⻆的"Build and Run"按钮。如果SDK已经初始化成功,应⽤程序将部署到您的iOS设备,您应该可以看到如下的app首页:

image-8

  1. sdk鉴权

  2. 您可以使用登录设置中的sdk鉴权功能,输入AppId和AppSecret,完成sdk鉴权:

image-9 image-10

本页目录