1

So I am trying to add a static library to my project in order to interface with a scanner. I have linked the binary in build phases to the libCaptuvoSDK.a, put the Captuvo.h header file in the project folder, and finally set the project to always search the user paths and added $(BUILT_PRODUCTS_DIR) recursive to the user header search paths. After doing all this I am trying to use #import "Captuvo.h" in my ViewController.swift file and getting the 2 errors Expected identifier in import declaration, and Expected expression. I have tried different combinations of importing and none of them seem to make a difference so I am led to believe the issue is with my process of adding the library.

I am new to Xcode and have never used a third party library in an application before so I feel I may be making a simple mistake or just misinterpreting things. Any help is appreciated!

Austin
  • 21
  • 1
  • 4
  • Have you tried just "import Captuvo" in your ViewController.swift file? (i.e. remove the # and .h") – Dean May 31 '16 at 20:24
  • Just getting the error "No such module 'Captuvo' " – Austin May 31 '16 at 20:31
  • Wanted to add that I found a few samples in the SDK. In the swift sample I found a Bridging-Header.h file with the `#import "Captuvo.h"` line. I made the same file in my own project in an attempt to see if it would resolve my issue but it hasn't. Going to keep looking at the sample for more clues though. – Austin Jun 01 '16 at 14:49

1 Answers1

1

Okay so I managed to fix my issue! I had imported the static library properly but the real issue was the header file. I fixed my issue by creating a new file in my projects folder named Quick-Scan-Bridging-Header.h. Inside that file is where the #import "Captuvo.h" line belonged. Once that was done I opened the Quick Scan apps build settings and under Objective-C Bridging Header I added the path Quick Scan/Quick-Scan-Bridging-Header. I also added the Header Search Path $(BUILT_PRODUCTS_DIR)

After I did all this I am able to use the Captuvo classes in my ViewController.swift file.

Austin
  • 21
  • 1
  • 4
  • Here is a link to a similar issue that helped me out a lot. http://stackoverflow.com/questions/26096402/xcode-myprojectname-bridging-header-h-does-not-exist – Austin Jun 01 '16 at 19:37