Has anyone managed to build a Cocoapod with a dependency on Couchbase Lite? I’m hitting problems like ‘target has transitive dependencies that include static binaries’. I’m adding the following line to the podspec
s.dependency 'couchbase-lite-ios', '~> 1.1'
I’ve successfully (a) added Couchbase to a project using a pod, and (b) built a pod with standalone code. The trouble is trying to build a pod with code that refers to Couchbase.
Maybe it can’t be done - I’ve see posts on the Cocoapod forums about serious voodoo needed to get some other frameworks to be included in pods.
I do use Couchbase Lite as a CocoaPod. That works nicely. What I want to do is to have my own functionality, wrapping CB things that every app needs, as a CocoaPod. That’s proving difficult.
Looking at Carthage is on my list. I like the idea that it’s simpler to set up than CocoaPods.
I’ve been trying to do something similar (see this thread Using CouchbaseLite inside a custom Framework / iOS8). Trying to use CBL in a swift custom framework for example but I haven’t managed to make it work. Are you using cocoapods with swift or objc? The framework would be called something like CBL utils to be used across several projects. A first step would be to get it to work without cocoapods I think. Have you manage to do that?
Yes, we’re trying to do the same thing. I’m using Cocoapods with Swift, and yes the intention is a framework to be used across several projects.
I can build a Swift Cocoapod of standalone code. I can use the Couchbase Cocoapod.
Are we sure it’s possible? I’m sure you’ve seen all the same StackOverflow and CocoaPod threads I’ve been reading on transitive dependencies and so on.
Add the following line in CouchbaseUtils.h to make the Couchbase Lite API accessible:
#import <CouchbaseUtils/CouchbaseLite.h>
Create a new single view application in the same workspace
In Link binary with libraries, add CouchbaseUtils.framework
Import the Couchbase Utils framework in swift classes
import CouchbaseUtils
Now, you should be able to use this CouchbaseUtils framework in other projects. Here, Couchbase Lite isn’t a pod which means that you will have to re-import it when a new version is available. It would be great to make it work with cocoapods so we’d only change the podfile to pull the new version.
I just tried it again and it doesn’t actually work.
Class in Xcode project:
import CouchbaseUtils
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib
let _ = CBLManager.sharedInstance()
}
...
}
Error message in Xcode:
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)