1

I'm trying to integrate Microsoft Bing Speech API with SpeechRecognitionService into my Swift application. Unfortunately, the Microsoft SDK only supports Objective-C atm, so I get around by adding #import "SpeechRecognitionService.h" to the Bridging Header after importing the SpeechSDK.framework, but I got the file not found error.

What am I doing wrong?

EDIT:

I did try import SpeechSDK framework directly into the needed class before but it was not working.

In my case, I'm still using the Bridging Header in order to import the framework. #import "SpeechRecognitionService.h" didn't work but a slight change as below works for me.

#import "SpeechSDK/SpeechRecognitionService.h"
Tim
  • 606
  • 1
  • 8
  • 19
  • Possible duplicate of [“file not found” in Bridging Header when importing Objective-C frameworks into Swift project by CocoaPod](http://stackoverflow.com/questions/34046676/file-not-found-in-bridging-header-when-importing-objective-c-frameworks-into-s) – Nikolay Shmyrev Oct 14 '16 at 13:43

2 Answers2

1

There is no need to add header to bridging header, you can simply import the framework. From apple docs:

Importing External Frameworks

You can import external frameworks that have a pure Objective-C codebase, a pure Swift codebase, or a mixed-language codebase. The process for importing an external framework is the same whether the framework is written in a single language or contains files from both languages. When you import an external framework, make sure the Defines Module build setting for the framework you’re importing is set to “Yes”.

You can import a framework into any Swift file within a different target using the following syntax:

import FrameworkName

See also “file not found” in Bridging Header when importing Objective-C frameworks into Swift project by CocoaPod

Community
  • 1
  • 1
Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
0

In my case, I'm still using the Bridging Header in order to import the framework. #import "SpeechRecognitionService.h" didn't work but a slight change as below works for me.

#import "SpeechSDK/SpeechRecognitionService.h"
Tim
  • 606
  • 1
  • 8
  • 19