Couchbase Lite dynamic lib via CocoaPods?

45 views
Skip to first unread message

Ben Kennedy

unread,
Feb 22, 2017, 1:48:13 PM2/22/17
to mobile-c...@googlegroups.com
Hey folks,

Is it possible to integrate CBL as a dynamic library when acquiring it via CocoaPods?

Our app has an action extension and a shared embedded framework, all of which use CBL. Despite in the Podfile confining 'couchbase-lite-ios' to the framework target only, the CBL classes nonetheless end up duplicately linked in both the framework and the app proper. (This is manifest by a spew of "Class CBLxxx is implemented in both X and Y. One of the two will be used. Which one is undefined." messages on launch.)

Perhaps due to sheer luck, CBL 1.2.1 seems to work despite the duplicate linkage. Unfortunately (but not surprisingly) CBL 1.3 does not work properly this way, so we have been forced to pin to 1.2.1 for the time being. Obviously, this is not a good state of affairs.

When I last tried to find a solution for this a few months ago, I was led to conclude that this is simply impossible via CocoaPods, because for some reason only an opaque static binary is distributed, rather than source that builds into a proper dynamic library.

Has this situation changed?

Is there a proper solution I've overlooked that will allow me to use CBL acquired via CocoaPods in a non-trivial app?

thanks,

-ben

David Brittain

unread,
Feb 22, 2017, 2:17:12 PM2/22/17
to mobile-c...@googlegroups.com
Are you sure you have properly restricted couchbase-lite to the shared
framework target only? We do this in our app (share a dynamic lib that
links couchbase with an app and extension) and don't have problems
with linker warnings. We are using 1.3.2

Dave
> --
> You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/E851FD20-7C5C-40FD-A2B2-C7D2F116072A%40kashoo.com.
> For more options, visit https://groups.google.com/d/optout.



--

David Brittain
Co-founder/CTO
@ConceptsApp

Ben Kennedy

unread,
Feb 22, 2017, 2:34:15 PM2/22/17
to Couchbase Mobile

On Wednesday, February 22, 2017 at 11:17:12 AM UTC-8, David Brittain wrote:
Are you sure you have properly restricted couchbase-lite to the shared
framework target only? We do this in our app (share a dynamic lib that
links couchbase with an app and extension) and don't have problems
with linker warnings. We are using 1.3.2

Well, given the duplicate linkage warnings, I suppose it's clear I haven't restricted it properly although I'm not sure why.

My Podfile has a structure like this (simplified for illustrative purposes):

use_frameworks!
project 'Kashoo.xcodeproj'
abstract_target 'Kashoo-iOS' do
  pod 'foo'    # pod exposed to all targets
  pod 'bar'    # pod exposed to all targets… etc.
  target 'KashooCommon' do    # shared framework (CBL)
    pod 'couchbase-lite-ios'
  end
  target 'Kashoo' do    # application (has a few app-only pods)
    pod 'baz'
    pod 'sac'
  end
  target 'Kashoo QE Extension'    # action extension (has no extension-specific pods)
end

Does this differ from your approach?

thanks,

-ben

David Brittain

unread,
Feb 22, 2017, 4:37:06 PM2/22/17
to mobile-c...@googlegroups.com
We don't have use_frameworks! perhaps that's why (we're an objective-C
based app).

Here's an abbreviated version of our pod file....

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
project 'Concepts.xcodeproj'

target 'ConceptsCore' do # shared framework
pod 'couchbase-lite-ios'
end

target 'Concepts' do # main app

end

target 'SpotlightSearch' do #search extension
end

target 'iMessage' do #imessage extension

end
> --
> You received this message because you are subscribed to the Google Groups
> "Couchbase Mobile" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mobile-couchba...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mobile-couchbase/417f93f0-7aa9-4b95-9d49-22561fe90ed8%40googlegroups.com.

James Nocentini

unread,
Feb 22, 2017, 5:09:12 PM2/22/17
to mobile-c...@googlegroups.com

Can you try with the 2.0 DB1 pod spec to see if it works as a framework with cocoa pods?

Ben Kennedy

unread,
Feb 24, 2017, 5:56:18 PM2/24/17
to mobile-c...@googlegroups.com

> On 22 Feb 2017, at 2:09 pm, James Nocentini <james.n...@gmail.com> wrote:
>
> See https://forums.couchbase.com/t/installing-couchbase-lite-with-cocoapods-in-a-framework/11790
>
> Can you try with the 2.0 DB1 pod spec to see if it works as a framework with cocoa pods?

At a quick glance, it looks favourable!

Alas I can't easily do a test integration with our real project at this early stage because of our use of CBLModel and replication.

-ben

Reply all
Reply to author
Forward
0 new messages