MrGeorgeous MrGeorgeous - 1 year ago 75
Objective-C Question

Smaato for Swift iOS: linker command with exit code 1 (use -v to see invocation)

Xcode gets error which you can see below


Smaato framework is Objective-C written framework but I use only Swift in my project. How can I manage this problem (I have only dragged and dropped Smaato framework to Xcode project space and checked that it works with import line)?

Answer Source

Swift project does not directly recognize Objective C files added to the project. There are a couple of steps after you drag and drop the framework to the project.

First, you have to create a Bridging-Header. Create a new Header file. Usually its named "project_name-Bridging-Header.h".

In Build Settings, search for "Objective-C Bridging Header" and set the value to Bridging header file name. You will have to provide the path from your project directory.

Now add import <iSoma/iSoma.h> in the Bridging Header. You should be then able to access the Objective file in Swift file.