How to get started

The SpeechKit Mobile SDK for the iOS platform is distributed as a static library that is available in the CocoaPods repository.

  1. Step 1. Install CocoaPods
  2. Step 2. Add the library to your project
  3. Step 3. Configure the library
  4. Step 4. Build and run the app

Step 1. Install CocoaPods

Install the CocoaPods dependency management system:

$ sudo gem install cocoapods

Step 2. Add the library to your project

  1. Go to the directory with the Xcode project (the directory where the file with the xcodeproj extension is located).

  2. Create a Podfile text file. This file will list the project's dependencies on other libraries in the future. To create the Podfile, you can use the pod init command:

    $ pod init
  3. Open the Podfile and add the dependency:

    pod 'YandexSpeechKit', '2.5.0'
    Note.

    You can also specify '~> 2.5' instead of the version number. This means that the project will use the library version 2.5.0 or newer minor versions, if they exist in the repository. If you only set pod 'YandexSpeechKit' in the Podfile, the latest version of the library will be used.

  4. Specify the platform and the minimum version:

    platform :ios, '6.0'
  5. To apply the changes, run this command in the project directory:

    $ pod install
    Note.

    In the future, you can use the pod update command to update the library version.

    After this, a file with the xcworkspace extension appears in the project folder. This is the file you should use for working on the project. Don't use the file with the xcodeproj extension. To open the project file, run the command:

    $ open *.xcworkspace

Step 3. Configure the library

To use the library in the app, it must be configured (initialized with the specified parameters). Open xcworkspace and make the following changes:

  1. Connect the library header file:

    #import <YandexSpeechKit/SpeechKit.h>
  2. Send a message to the -configureWithAPIKey: method of the YSKSpeechKit class that passes the value of the API key:

    [[YSKSpeechKit sharedInstance] configureWithAPIKey:@"API key"];

Step 4. Build and run the app

Build the app. To launch it, you can use:

  • An iOS device connected to the developer's computer via USB.

    Choose Product → Destination in the menu, then select the device in the Device section.

  • An emulator.

    Choose Product → Destination in the menu, then select a simulator in the iOS Simulators section.

Run the app. To do this, choose Product → Run in the menu.

Did something go wrong?

Take a look at the sample project.