Reputation: 720
I want to use the Objective-C library https://github.com/ameingast/cocoaimagehashing in a Swift project. I installed it with Cocoapods. I cannot use it, it throws the following errors when I build: “use of undeclared type” or "Use of unresolved identifier".
It is surprising that when I write OSImageHashingProvider and click on it, it jumps in the .h file it is defined.
I added a bridging header in the project, but I don’t have reasons to believe it is active.
I added it in Build Settings -> Swift Compiler - General / Objective C Brigding Header.
Build Settings -> Other Linker Flags has -ObjC. and -l “CocoaImageHashing”.
My pod is :
target 'Projectname' do
pod 'CocoaImageHashing', :git => 'https://github.com/ameingast/cocoaimagehashing.git'
end
I don’t use use_frameworks! because it throws an error at build.
What is the solution?
Upvotes: 1
Views: 2323
Reputation: 720
The problem was that Cocoapods does not install correctly this specific library.
At Target level, in Build Settings -> Search Paths -> Header Search Paths: there is a path generated by Cocoapods that does not correspond to any actual folder structure: "${PODS_ROOT}/Headers/Public/CocoaImageHashing" when the /Headers/Public structure does not exist. I removed that and remained with ${PODS_ROOT}/CocoaImageHashing , corresponding to the folder Projectname/Pods/Pods-Projectname.debug.xcconfig and now the library was seen.
Upvotes: 2