Objc-class-ref error in couchbase lite in iOS cocoapods xcode 9

Integrating CouchbaseLite in iOS application causing error through cocoapods . Here is error i am getting :

Undefined symbols for architecture x86_64:
OBJC_CLASS$_CBLManager”, referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What does your Podfile look like ? Can you confirm that you have the couchbase lite framework linking with the right target?

(Also assuming you are working on a ObjC iOS app here ? If not, make sure you set the bridging header as per the instructions here

The usual cause of this is that you’re linking with the Mac library not the iOS one.

I appreciate your response on this.

Here is pod file :
pod ‘couchbase-lite-ios’, '~> 1.4.0’
this is this pod file , which i used in iOS project .
Apart from this , i also used Bridging header :
#import “CouchbaseLite/CouchbaseLite.h” in CouchBaseDemo-Bridging-Header.h and set objective c header in project and target setting but still m getting same issue .

i am using pod ‘couchbase-lite-ios’, ‘~> 1.4.0’ cocoapods to integrate it , not mac .

I wanted to see the contents of entire Podfile. Can you share that ? I want to check what targets are being linked to and confirm it’s OK

Here it is :

#Uncomment the next line to define a global platform for your project
#platform :ios, ‘9.0’

target ‘CouchBaseDemo’ do
#Comment the next line if you’re not using Swift and don’t want to use dynamic frameworks

#Pods for CouchBaseDemo
pod ‘couchbase-lite-ios’, ‘~> 1.4.0’


Looks fine to me at a glance.

If possible, if you can provide me access to the demo, I can take a quick look to verify the framework path and other build settings to see if anything was in inadvertently missed,

Here i have pushed my code into Public Github :

Kindly check and please help me to fix this issue .

I took a look at your project and noticed a couple of issues in your project configuration. Fixing the issues , resolved the issue. See details below.

(Related Note: you may want to refer to this blog post that shows how you can get started with CBL and provides you with a starter app)

  • The “Other Linker” flags was set to “-ObjC”. Change that to $(inherited). That will ensure that Cocoapods is able to include the appropriate flags. Otherwise your cocoa pods install won’t go through fine.

*This is what you have *

21 PM

AFTER you fix the above, This is what you should see
52 PM

  • Also, not specifically related but an issue nevertheless that will come to bite you later, I noticed that your bridging header path was hardcoded. Make sure that it’s not the case. The best way to add a bridging header is to add a ObjC .m file and when you do that, you will be prompted to add a bridging header . Make sure you accept that. The system will add a bridging header for your project and you can add the import file to it.

21 PM

1 Like

Big Thank you . I really appreciate your help , issue is resolved now . I did the same changes and its working fine .
Once again thanks.

Cool! You are welcome!

1 Like