0

Xcode gets error which you can see below

Error

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)?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253

2 Answers2

0

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.

Adithya
  • 4,545
  • 3
  • 25
  • 28
  • My swift file has 'import iSoma' and I have created header.h file with contents - #ifndef header_h #define header_h #import #endif But I'm still having this error – MrGeorgeous Aug 24 '16 at 12:14
  • Integrating Swift From version 8.x onward, the Smaato iOS SDK comes with a built-in Swift module structure. Just drag and drop the framework to the Swift project and you're set - no bridging headers required. – MrGeorgeous Aug 24 '16 at 12:16
  • @MrGeorgeous Ok, I am not sure about Xcode 8, but I tried my above mentioned method and it works. – Adithya Aug 24 '16 at 15:43
0

check whether you have added following frameworks: UIKit,Foundation,StoreKit,CoreTelephony,SystemConfiguration,MessageUI,AdSupport,QuartzCore,CoreLocation,CoreImage,CoreFoundation,EventKit