Couchbase 1.2 with ForestDB on Xamarin.iOS

.net

#1

I’m having some trouble getting Couchbase Lite 1.2’s ForestDB to be enabled on a Xamarin.iOS project.

I have included the Nuget packages:
Couchbase.Lite
Coucbhase.Lite.Storage.ForestDB
Couchbase.Lite.Storage.SystemSQLite

I also changed my StorageType property to “ForestDB”.
Manager.SharedInstance.StorageType = “ForestDB”;

When I run my app, I get output that says:
" ForestDBCouchStore: WARNING: ForestDB Native components missing"

Okay, I think that means I need to install the libCBForest-Interop.dylib.

I ran the ./build-interop-ios-fat.sh from the directory and have a couple of builds for libCBForest-Interop.dylib (one for device and one for the simulator).

I’m not sure what to do now. Is there a recommended way to get this to work more seamlessly on Xamarin.iOS? Thank you.


#2

Is this in the simulator or on the device (I’m guessing simulator)? For iOS, the native components will be statically linked into the actual managed DLL since iOS only supports dynamic libraries from iOS 8. You don’t need to build the native package yourself (that is what the nuget package is for, but it seems there are some growing pains). Here are some things to check:

  1. Is the package installed on the project that is being deployed to the device (and not an intermediate DLL project?)

  2. In the output directory, what is the file size of cbforest-sharp.dll. If it is 38k then the wrong file is being copied somehow. Try doing a clean build.

Let me know about these things.


#3

Hi Jim,

I’m currently trying to get this to work in the simulator first. I also found the prebuilt after I posted the message and have been using those. At first, my builds for cbforest-sharp.dll was 33,280 bytes (37 KB). When I referenced that and built my project files, it built on that was 33.2MB in size (33,202,688 bytes), but when I deploy it to the simulator, what gets copied to ~/Library/Developer/CoreSimulator/Devices/{DeviceGuid}/data/Containers/Bundle/Application/{AppGuid} package is the smaller, 37KB sized cbforest-sharp.dll. I even tried removing all references to the smaller one and forcing the deploying project to copy the larger .dll, but it is still copying the smaller .dll for some reason.


#4

If you have any explicit references to cbforest-sharp then you should remove them. The only thing you need to do is make sure that your application project is including the .targets file from the ForestDB package.

It will look like

<Import Project="packages\Couchbase.Lite.Storage.ForestDB.1.2\build\Xamarin.iOS10\Couchbase.Lite.Storage.ForestDB.targets" Condition="Exists('packages\Couchbase.Lite.Storage.ForestDB.1.2\build\Xamarin.iOS10\Couchbase.Lite.Storage.ForestDB.targets')" />

However, just so you know, I’m planning to make another big overhaul of this packaging system because it is causing too much grief.


#5

Hi Jim,

I was able to figure out a little better which cbforest-sharp.dll file was being copied and where that was. That lead me to remove my packages for my main .iOS project and my .dll project and re-add them. I took out all explicit references and now it is detecting the forestDB. :). Now I can dive back in the code and figure out how to upgrade my DB files. Thanks for your help! :smile: