GithubHelp home page GithubHelp logo

couchbaselabs / couchbase-lite-phonegap-plugin Goto Github PK

View Code? Open in Web Editor NEW
183.0 171.0 67.0 203.73 MB

Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android

Objective-C 95.87% Java 2.83% JavaScript 0.20% HTML 0.97% C 0.14%

couchbase-lite-phonegap-plugin's Introduction

⚠️ This repo is obsolete. It is no longer maintained and based on a version of Couchbase Lite that reached end of life years ago.

PhoneGap plugin for Couchbase Lite

Couchbase Lite is an embedded JSON database for occasionally connected devices. It syncs data in the background, so users can collaborate across devices. There is an event based _changes JSON feed API so you can drive data-binding UI frameworks like Sencha and Backbone to reflect remote updates interactively.

It works with native code as well as Cordova / PhoneGap on iOS and Android (you can even sync with Mac desktops), so it doesn't matter where your users are, they can work with the data, and as soon as they get back online, everyone will see their changes.

For instructions on using the plugin, see the PhoneGap Getting Started page.

Architecture

This is where the plugin fits in the picture:

architecture.png

Where to go from here

There's an example chat app with PhoneGap that illustrates the channel sync API. You can read more about the app here.

If you made it this far, you are now ready to build your custom PhoneGap App by editing the HTML, CSS, and Javascript files under the www directory. Your same application code will work on both the iOS and Android platforms!

couchbase-lite-phonegap-plugin's People

Contributors

borrrden avatar jamesnocentini avatar pasin avatar swaheed2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

couchbase-lite-phonegap-plugin's Issues

Query with jquery.couch.js

Hi,
I'm using jquery.couch.js (version found with the latest CouchApp) to do the requests in LiteGap.
Reference of the script : http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/
openDoc(), allDocs() and allDbs() work very well, but I can't get a query working :

I tried this map function

var mapFunction = function(doc) {
    emit(doc._id, doc);
};

And several others with this query :

$.couch.db("mydb").query(mapFunction, "_count", "javascript", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    },
    reduce: false
});

I expected to get all my docs correctly but I got an empty array.
My db is a small one : only 49 docs that are lightweight.

If this is just a syntax mistake, I apologize !

Thank You

Version 1.0.2 doesn't install cleanly using the Cordova CLI

Running

cordova plugin add [email protected]

results in the following error:

Failed to install 'com.couchbase.lite.phonegap':Error: Uh oh!
"/home/gareth/Dev/mobile/plugins/com.couchbase.lite.phonegap/lib/android/cblite_android_.zip" not found!
at Object.module.exports.common.copyFile (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:43:40)
at Object.module.exports.common.copyNewFile (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:60:16)
at module.exports.source-file.install (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:51:20)
at Object.ActionStack.process (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:70:25)
at handleInstall (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:560:20)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:320:20
at _fulfilled (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:760:13)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:574:44

plugin.xml does contain a reference to

<source-file src="lib/android/cblite_android_.zip" target-dir="libs"/>

but that zip doesn't exist in the lib directory. I'm guessing we can just remove the reference to it from plugin.xml?

Doesn't work with cordova 3.0 on Android

This plugin doesn't work with the new cordova 3.0 on Android (I haven't tested other platforms).

The error is as follows:

> cordova plugin add https://github.com/couchbaselabs/LiteGap
[Error: grafting xml at selector "plugins" from "phonegap/platforms/android/res/xml/config.xml" during config install went bad :(]

Initially I thought it was just because plugins are now features, so I made a couple of modifications (see https://github.com/alexiri/LiteGap/compare/couchbaselabs:master...master). These changes actually allow the plugin to be installed, but apps still don't work. Here's the error message:

07-20 23:15:46.978    W/dalvikvm: dvmFindClassByName rejecting ''
07-20 23:15:46.978    W/System.err: java.lang.ClassNotFoundException:
07-20 23:15:46.978    W/System.err: at java.lang.Class.classForName(Native Method)
07-20 23:15:46.978    W/System.err: at java.lang.Class.forName(Class.java:217)
07-20 23:15:46.978    W/System.err: at java.lang.Class.forName(Class.java:172)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.PluginEntry.getClassByName(PluginEntry.java:117)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.PluginEntry.createPlugin(PluginEntry.java:93)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:264)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.PluginManager.execHelper(PluginManager.java:219)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
07-20 23:15:46.978    W/System.err: at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
07-20 23:15:46.978    W/System.err: at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
07-20 23:15:46.978    W/System.err: at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
07-20 23:15:46.978    W/System.err: at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:92)
07-20 23:15:46.978    W/System.err: at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108)
07-20 23:15:46.978    W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
07-20 23:15:46.978    W/System.err: at android.os.Looper.loop(Looper.java:137)
07-20 23:15:46.978    W/System.err: at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:827)
07-20 23:15:46.978    W/System.err: at java.lang.Thread.run(Thread.java:856)
07-20 23:15:46.978    I/System.out: Error adding plugin .
07-20 23:15:46.978    D/PluginManager: exec() call to unknown plugin: LiteGap

I can do a new LiteGap() from my main application class, so the plugin code is properly included in my project and seems to compile. However, Cordova still can't see the plugin. Any ideas?

not able to compile

i am using :

http://plugins.cordova.io/#/package/com.couchbase.lite.phonegap

and just added to a cordova created standard project and this error shows up :

[2014-05-22 13:11:50 - rroc5app] The library 'cbl_collator_so-1.0.0-72.jar' contains native libraries that will not run on the device.
[2014-05-22 13:11:50 - rroc5app] Additionally some of those libraries will interfer with the installation of the application because of their location in lib/
[2014-05-22 13:11:50 - rroc5app] lib/ is reserved for NDK libraries.
[2014-05-22 13:11:50 - rroc5app] The following libraries were found:
[2014-05-22 13:11:50 - rroc5app]  - lib/armeabi-v7a/libcom_couchbase_touchdb_RevCollator.so
[2014-05-22 13:11:50 - rroc5app]  - lib/armeabi-v7a/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-05-22 13:11:50 - rroc5app]  - lib/armeabi/libcom_couchbase_touchdb_RevCollator.so
[2014-05-22 13:11:50 - rroc5app]  - lib/armeabi/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-05-22 13:11:50 - rroc5app]  - lib/mips/libcom_couchbase_touchdb_RevCollator.so
[2014-05-22 13:11:50 - rroc5app]  - lib/mips/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-05-22 13:11:50 - rroc5app]  - lib/x86/libcom_couchbase_touchdb_RevCollator.so
[2014-05-22 13:11:50 - rroc5app]  - lib/x86/libcom_couchbase_touchdb_TDCollateJSON.so

Error Making a Get to Design Documents

When I try to do a Get to a view in the ToDoLite example with the last version of Phonegap, so the beta3 rc10, I got this error :

05-15 13:57:52.790: W/View(6146): Failed to rebuild view todo9/lists.  Result code: 500
05-15 13:57:52.790: E/Router(6146): Router unable to route request to do_GET_DesignDocument
05-15 13:57:52.790: E/Router(6146): java.lang.reflect.InvocationTargetException
05-15 13:57:52.790: E/Router(6146):     at java.lang.reflect.Method.invokeNative(Native Method)
05-15 13:57:52.790: E/Router(6146):     at java.lang.reflect.Method.invoke(Method.java:515)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.router.Router.start(Router.java:464)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.listener.LiteServlet.service(LiteServlet.java:128)
05-15 13:57:52.790: E/Router(6146):     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
05-15 13:57:52.790: E/Router(6146):     at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2251)
05-15 13:57:52.790: E/Router(6146):     at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2176)
05-15 13:57:52.790: E/Router(6146):     at Acme.Serve.Serve$ServeConnection.run(Serve.java:1988)
05-15 13:57:52.790: E/Router(6146):     at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1223)
05-15 13:57:52.790: E/Router(6146):     at java.lang.Thread.run(Thread.java:841)
05-15 13:57:52.790: E/Router(6146): Caused by: android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1
05-15 13:57:52.790: E/Router(6146):     at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426)
05-15 13:57:52.790: E/Router(6146):     at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
05-15 13:57:52.790: E/Router(6146):     at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:74)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.android.AndroidSQLiteStorageEngine$SQLiteCursorWrapper.getLong(AndroidSQLiteStorageEngine.java:189)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.View.updateIndex(View.java:471)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.router.Router.queryDesignDoc(Router.java:1683)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.router.Router.do_GET_DesignDocument(Router.java:1714)
05-15 13:57:52.790: E/Router(6146):     ... 10 more
se.lite.View.updateIndex(View.java:471)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.router.Router.queryDesignDoc(Router.java:1683)
05-15 13:57:52.790: E/Router(6146):     at com.couchbase.lite.router.Router.do_GET_DesignDocument(Router.java:1714)
05-15 13:57:52.790: E/Router(6146):     ... 10 more

By the way, I don't know if it's useful or not, but I'm using cordova 3.3.0 and, in order to make the example works, I need to do these steps :

  • Download http://cl.ly/Pr1r/td_collator_so_enhanced.jar.
  • Rename the downloaded td_collator_so_enhanced.jar file to td_collator_so_enhanced.zip.
  • Decompress the td_collator_so_enhanced.zip file.
  • Copy the 3 folders in the libs folder in your project and delete the td_collator_so_enhanced.jar.

Update plugin.xml with changes to couchbase-lite-android jars

A new jars has been added to Android, and the jars have been renamed.

Eg the plugin.xml should be:

    <source-file src="lib/android/couchbase-lite-android-1.0.0-beta3rc1.jar" target-dir="libs"/>
    <source-file src="lib/android/couchbase-lite-java-core-1.0.0-beta3rc1.jar" target-dir="libs"/>
    <source-file src="lib/android/couchbase-lite-java-javascript-1.0.0-beta3rc1.jar" target-dir="libs"/>
    <source-file src="lib/android/couchbase-lite-java-listener-1.0.0-beta3rc1.jar" target-dir="libs"/>

Notes from @jchris:

I think this ticket is basically blocked on http://www.couchbase.com/issues/browse/CBLT-237

is it ready for production use?

I am not seeing proper documentation here, so wanted to makes sure. The one on Couchbase's website is obsolete pointing to some other page where I did not find any reference to Phonegap.

Couchbase Lite REST API calls partly implemented in PhoneGap plugin

Hello,

Using version 1.1.1

Unless I am doing something wrong, it seems that part of the REST couchbase lite API is not available using the couchbase lite PhoneGap plugin. For instance I am triying to use GET /_all_dbs but it fails with message:
return this.makeRequest('GET', this.databaseUrl + '/_all_dbs');
===> error 400: Invalid database

I was willing to use above to get the name of the replication DB. I tried previously to access _all_docs from _replicator database but I received an error:
return this.makeRequest("GET", this.databaseUrl + '_replicator' + "/_all_docs");
===> "Router unable to route request to DO_GET_replicator"

I tried to access the /_config DB to change some settings but this one is not routed too. Note here that I found this in CouchDB documentation and might not be available at all.

My questions are:
1- Am I doing something wrong?
2- Do you plan to implement them? Alternatively may I get some information on where I can implement them?

The underlying of above requests is that we need to know the connection status with the couchbase sync gateway. We have currently implemented a periodic call to the sync with the GET {} to achieve it but this is sub optimal and generates unnecessary traffic.

Thanks!

change the imports in the plug in to cordova 3.0

hi,

the following libs should be updated in the cordova 3.0 plugin, removing .api from the package name.

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaInterface;

Cross-origin access errors with GapReload and Phonegap Developer App

Couchbase Lite does not work with rapid development tools that implement live app reload and eliminate the compile and install step (i.e. calling cordova run every JS/HTML change). These tools include:
GapReload and Adobe's PhoneGap Developer App. They work by redirecting the webview from a file:// location to a server on the developer's machine started by cordova serve.
When we try to connect to Couchbase Lite in such setup, an error is thrown:

XMLHttpRequest cannot load http://lite.couchbase./temp. Origin http://192.168.1.104:8000 is not allowed by Access-Control-Allow-Origin.

The cross-resource origin policy is not applied when the embedded web application is served from the standard location using file://, but it is after the redirection to http://

A solution would be to add a header to HTTP responses returned by Couchbase Lite:

Access-Control-Allow-Origin: *

iOS build fails when using this plugin

here is the message I am getting:

MacBook-Pro:BackbuttonTest username$ cordova build ios
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/username/fun/cordova/BackbuttonTest/platforms/ios/cordova/build" 

/usr/local/node-v0.10.24/lib/node_modules/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error: An error occurred while building the ios project.** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
** BUILD FAILED **


The following build commands failed:
    CompileC build/BackButtonDemo.build/Debug-iphonesimulator/BackButtonDemo.build/Objects-normal/i386/CBLite.o BackButtonDemo/Plugins/com.couchbase.lite.phonegap/CBLite.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

    at ChildProcess.<anonymous> (/usr/local/node-v0.10.24/lib/node_modules/cordova/src/compile.js:65:22)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

Cordova version:
3.3.0-0.1.0

can not get Cookies from XHR response

when I using following command to call sync gateway rest api, such as:
curl -i -X POST -H "Content-Type:application/json" -d '{"name":"testuser","password":"password"}' http://127.0.0.1:4984/default/_session

I can get response cookies like this:
TTP/1.1 200 OK
Content-Length: 130
Content-Type: application/json
Server: Couchbase Sync Gateway/1.00
Set-Cookie: SyncGatewaySession=7ae020214fe1699d640e6402371a473f75ff2a41; Path=/default/; Expires=Fri, 26 Jun 2015 15:40:37 UTC
Date: Thu, 25 Jun 2015 15:40:37 GMT

{"authentication_handlers":["default","cookie"],"ok":true,"userCtx":{"channels":{},"name":"testuser"}}

but when I send the same ajax request from my android apps build from Couchbase-Lite-PhoneGap-Plugin,I can not get Cookies in response (I can get response body without Cookies:SyncGatewaySession).

the section in my config.xml is like this:

Support for 64bit

Will the plugin be updated to support 64bit framework? Got x86_64 error when try to build for 64bit machine in XCode.

iOS app Crash with 1.1.0

Hi,
after I have upgraded to 1.1.0 the app crashes with the following error:
2015-09-05 12:38:34.674 DivePlan[5271:22369519] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (NaN) in JSON write'
*** First throw call stack:
(
0 CoreFoundation 0x000000010964fc65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d57dbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010964fb9d +[NSException raise:format:] + 205
3 Foundation 0x000000010d21bc26 _writeJSONNumber + 748
4 Foundation 0x000000010d217efc _writeJSONValue + 477
5 Foundation 0x000000010d21c46f ___writeJSONObject_block_invoke + 220
6 CoreFoundation 0x000000010958f656 __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
7 CoreFoundation 0x000000010958f55c -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204
8 Foundation 0x000000010d21c080 _writeJSONObject + 376
9 Foundation 0x000000010d217ea6 _writeJSONValue + 391
10 Foundation 0x000000010d217cea -[_NSJSONWriter dataWithRootObject:options:error:] + 137
11 Foundation 0x000000010d21a76b +[NSJSONSerialization dataWithJSONObject:options:error:] + 345
12 DivePlan 0x000000010912be44 +[CBLJSON dataWithJSONObject:options:error:] + 172
13 DivePlan 0x000000010913b887 -[CBL_SQLiteViewStorage _emitKey:value:valueIsDoc:forSequence:] + 180
14 DivePlan 0x000000010913b540 __39-[CBL_SQLiteViewStorage updateIndexes:]_block_invoke159 + 97
15 DivePlan 0x00000001090aab57 -[CBLJSViewCompiler emitWithKey:value:] + 38
16 DivePlan 0x00000001090aaac6 __25-[CBLJSViewCompiler init]_block_invoke + 79
17 CoreFoundation 0x0000000109545dec _invoking
+ 140
18 CoreFoundation 0x0000000109545c42 -[NSInvocation invoke] + 290
19 JavaScriptCore 0x000000010cca2a61 ZN3JSC24ObjCCallbackFunctionImpl4callEP9JSContextP13OpaqueJSValuemPKPKS3_PS6 + 433
20 JavaScriptCore 0x000000010cca25d6 ZN3JSCL34objCCallbackFunctionCallAsFunctionEPK15OpaqueJSContextP13OpaqueJSValueS4_mPKPKS3_PS6 + 262
21 JavaScriptCore 0x000000010cca3775 _ZN3JSC19APICallbackFunction4callINS_20ObjCCallbackFunctionEEExPNS_9ExecStateE + 517
22 JavaScriptCore 0x000000010cb7c38e _ZN3JSC14handleHostCallEPNS_9ExecStateENS_7JSValueENS_22CodeSpecializationKindE + 542
23 JavaScriptCore 0x000000010cb7c542 linkFor + 162
24 ??? 0x00000334d2dc4d64 0x0 + 3525410835812
25 ??? 0x00000334d2dc86f0 0x0 + 3525410850544
26 JavaScriptCore 0x000000010cc6f881 callToJavaScript + 311
27 JavaScriptCore 0x000000010cb53ea3 _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 35
28 JavaScriptCore 0x000000010cb368a0 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 480
29 JavaScriptCore 0x000000010c972fde _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 62
30 JavaScriptCore 0x000000010cbf7190 JSObjectCallAsFunction + 688
31 JavaScriptCore 0x000000010cc2993e -[JSValue callWithArguments:] + 286
32 DivePlan 0x00000001090aa7b0 -[CBLJSFunction call:] + 357
33 DivePlan 0x00000001090aacb1 __49-[CBLJSViewCompiler compileMapFunction:language:]_block_invoke + 63
34 DivePlan 0x000000010913ad6e __39-[CBL_SQLiteViewStorage updateIndexes:]_block_invoke + 6605
35 DivePlan 0x000000010912fd26 -[CBL_SQLiteStorage inTransaction:] + 100
36 DivePlan 0x000000010913926f -[CBL_SQLiteViewStorage updateIndexes:] + 225
37 DivePlan 0x00000001090c533c -[CBLView updateIndexes:] + 78
38 DivePlan 0x00000001090c5268 -[CBLView updateIndex] + 57
39 DivePlan 0x00000001091616ac -[CBL_Router(Handlers) queryDesignDoc:view:keys:] + 550
40 DivePlan 0x0000000109161ab3 -[CBL_Router(Handlers) do_GET:designDocID:view:] + 53
41 DivePlan 0x00000001091585ca -[CBL_Router route] + 3367
42 DivePlan 0x0000000109158b61 -[CBL_Router run] + 859
43 Foundation 0x000000010d12f69a __NSThreadPerformPerform + 299
44 CoreFoundation 0x0000000109583431 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
45 CoreFoundation 0x00000001095792fd CFRunLoopDoSources0 + 269
46 CoreFoundation 0x0000000109578934 __CFRunLoopRun + 868
47 CoreFoundation 0x0000000109578366 CFRunLoopRunSpecific + 470
48 Foundation 0x000000010d133f92 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 275
49 DivePlan 0x00000001090b0fe5 -[CBL_Server runServerThread] + 315
50 Foundation 0x000000010d13209d __NSThread__main
+ 1194
51 libsystem_pthread.dylib 0x000000010dcfc05a _pthread_body + 131
52 libsystem_pthread.dylib 0x000000010dcfbfd7 _pthread_body + 0
53 libsystem_pthread.dylib 0x000000010dcf93ed thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

If I go back to 1.0.4 everything works fine.
Any idea how to solve it?
Thanks
schermata 2015-09-05 alle 12 40 43

Debug mode to run the app in the browser

Instead of recompiling the source code through XCode with the phonegap build ios command every time a file is changed, it's easier to develop the app running in the browser.
If PhoneGap allows debug flags to be passed in the phonegap build ios command for example, we could have extra logic in CBLLite.m to use the lite.couchbase./ or the public hostname depending on the environment (dev or prod). I've seen a couple intances where users expected the listener to be accessible from Chrome/Safari.

Update View doesn't update the index

Hi,

When I update a view using the rest API the index is not updated. This then gives strange results mixing the indexes of the old views with the new one. Is this a normal behavior or am I missing something ?

The only way I found to update a view was to rename it (_view/foo1 becomes _view/foo2). But this implies to rename all the calls to the view as well.

Regards.

Unable to add plugin to phonegap build

I tried to add the plugin to the config.xml file and build the project using the phonegap build service.
and got this error:

Unable to create app: plugin unsupported: com.couchbase.lite.phonegap 

Then I tried to add the plugin to user submitted plugins https://build.phonegap.com/plugins#add and got this error.

Compiled binaries are not allowed in user submitted plugins: lib/ios/libCBLJSViewCompiler.a

what's the proper way to include the phonegap plugin in the phonegap build service ?

Replicator error - can't push to SG

This bug appears since the last update of this plugin (or I haven't seen it before). The first problem I have it's I can't reproduce it every times but only some times.

The bug:
My device doesn't make any push to the Sync Gateway but can pull any docs. It seems to come from at the connection with the sync gateway when I start the application. I got this error :

06-04 11:11:45.516: V/Listener(18097): Authorized via basic auth
06-04 11:11:45.596: E/Router(18097): Replicator error: java.lang.Exception: com.couchbase.lite.support.RemoteRequest@421ab9c0: Request org.apache.http.client.methods.HttpGet@42178ee8 has been aborted.  Repl: Pusher@421a5958[http://---:[email protected]:12345/customers].  Source: customersregistered, Target: http://amel:[email protected]:12345/customers

As I said before, I don't know how to reproduce it correctly as it happens randomly for me.
I'm using the last version of this plugin, the 1.0.0-72 and the same goes for the sync gateway and the server.
To connect to the sync gateway, I'm using the basic http authentication putting the username and password to the url (http://username:[email protected]:12345/customers), adding before the user with a curl request to the SG.

cblite plugin can not be found after upgraded to 1.1.1 version

Hello,
I upgraded xcode to 7 and also this plugin to latest 1.1.1 version, the whole cbl does not work due to window.cblite plugin can not be found. Then I restored the cblite plugin to the 1.1 version, my app works again, nothing else is changed.

What could be the problem?

BTW, I could not understand why not keep revisions in this repository? how can I get an earlier version?

Thanks!

com.couchbase.lite.replicator.ChangeTracker: Exception in change tracker

sorry if its a duplicate of #22

recap

  • i'm on android 4.4 (device lg nexus 4)

  • i'm using the com.couchbase.lite.phonegap version 1.0.0 / master

  • i have set up a sync gate way that i can interact with e.g. with curl:

    $ curl -D /tmp/header.dump -X GET https://user:[email protected]/myapp/
    {"committed_update_seq":0,"compact_running":false,"db_name":"myapp","disk_format_version":0,"instance_start_time":1402771312189880,"purge_seq":0,"update_seq":0}

device

i have a cordova app running and can successfully interact with the couchbase lite e.g. a get:

$.ajax({
type: "GET",
url: 'http://97421ce8-b9cd-4dd0-bd6e-4909757145fc:ecb708a9-27ce-42bc-91f2-b37deb9eecff@localhost:5984/myapp',
success: function (msg) { console.log('succes: ', msg); response = msg; },
error: function (err){ console.log('error: ', err); response = err;} 
});
// response
Object {disk_size: 106496, update_seq: 3, doc_count: 3, instance_start_time: 1403273242756000 ...

replicate problem

but when I try to replicate -> i do a POST of
{
'create_target' : true,
'source' : https://user:[email protected]/myapp,
'target' : 'myapp'
}

to

http://97421ce8-b9cd-4dd0-bd6e-4909757145fc:ecb708a9-27ce-42bc-91f2-b37deb9eecff@localhost:5984/myapp/_replicate

and the following traceback in the adb logcat:

          Listener  W  authHeader is null
                    W  Unauthorized -- requestCredentials not given or do not match allowed credentials
          dalvikvm  D  GC_FOR_ALLOC freed 116K, 6% free 10060K/10608K, paused 17ms, total 17ms
                    D  GC_FOR_ALLOC freed 96K, 6% free 10061K/10608K, paused 17ms, total 17ms
          Listener  V  Authorized via basic auth

...
<4-5 secs>
...
ChangeTracker  E  com.couchbase.lite.replicator.ChangeTracker@42991bc8: Exception in change tracker
            E  org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true'
               , 'false' or 'null')
            E   at [Source: org.apache.http.conn.EofSensorInputStream@428aebc8; line: 1, column: 2]
            E      at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1432)
            E      at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
            E      at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
            E      at org.codehaus.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:2084)
            E      at org.codehaus.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:600)
            E      at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:486)
            E      at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2761)
            E      at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2709)
            E      at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1900)
            E      at com.couchbase.lite.replicator.ChangeTracker.run(ChangeTracker.java:319)
            E      at java.lang.Thread.run(Thread.java:841)

It does not seem possible to create an admin user in CDBLite

I posted the admin credentials as below
curl -s -X PUT htp://10.111.22.247:5984/_config/admins/admin -d '"admin"'
and got no response from the server. I then attempted to list the admin users as below
curl -s http://admin:[email protected]:5984/_users/_all_docs
And got the response below:
{"error":"not_found","reason":"Router unable to route request to do_GET_users"}

Can I assume that CDBLite does not support securing the DB using an Admin user? If so , is this support planned? if not, what might I be doing wrong?

many thanks
Abraham

Crash after Persona login: "-[UIWindow presentViewController:animated:completion:]: unrecognized selector"

When configured as a chat app, I've started hitting a crash right after Persona login, before the regular UI appears.

2013-04-19 11:25:36.365 LiteGap[30894:c07] -[UIWindow presentViewController:animated:completion:]: unrecognized selector sent to instance 0x12269fb0
(lldb) bt
* thread #1: tid = 0x1c03, 0x02ef8e52 libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 1.1
    frame #0: 0x02ef8e52 libobjc.A.dylib`objc_exception_throw
    frame #1: 0x006af4bd CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 253
    frame #2: 0x00613bbc CoreFoundation`___forwarding___ + 588
    frame #3: 0x0061394e CoreFoundation`_CF_forwarding_prep_0 + 14
    frame #4: 0x00007bb2 LiteGap`-[PersonaController(self=0x09d98860, _cmd=0x00363d85, parentController=0x12269fb0) presentModalInController:] + 546 at PersonaController+UIKit.m:52
    frame #5: 0x00006261 LiteGap`-[CBCordovaPersona presentPersonaDialog:](self=0x0b877680, _cmd=0x00363eb4, urlCommand=0x09d71ea0) + 897 at CBCordovaPersona.m:31
    frame #6: 0x0006691b LiteGap`-[CDVCommandQueue execute:](self=0x09888a70, _cmd=0x00363aae, command=0x09d71ea0) + 1099 at CDVCommandQueue.m:146

The problem is that CBCordovaPersona (frame 5) is looking up the root view controller like so:

    id rootVC = [[[[[UIApplication sharedApplication] keyWindow] subviews] objectAtIndex:0] nextResponder];

but in this case the object it gets is a UIWindow, not a UIViewController:

(lldb) po rootVC
$1 = 0x12269fb0 <UIWindow: 0x12269fb0; frame = (0 0; 320 568); layer = <UIWindowLayer: 0x12269f70>>

That line of code I quoted doesn't look very robust — it's making assumptions about the ordering of subviews and the current responder chain.

Windows Phone 8 support

Couchbase Lite (Mobile) do support .Net, but the plugin has no support to WP8, any reason?

Document deleted not replicated randomly

When I try to delete a document by putting the "_deleted=true" and then, making a PUT, it replicates to the SG but not to the other device...

I can replicate other documents to the other device but I can't replicate the document i have deleted. I can see the document deleted on the SG but not on the other device.

What is odd as well that I don't have any error in the logs except the changeTracker one and the document deleted not replicating happens randomly, I mean, it cannot replicate a document deleted and when I try to another document 2 min later, it works fine again but without replicating the first document deleted, only the second one.

Build preview plugin from current master

One of PhoneGap Plugin user encounters performance issue with Android. We should provide the build from master couchbase-lite-java-core and couchbase-lite-android

Basic auth headers

Passing the username/pass into the url doesn't seem to work

Workaround:

Index.js

    function setupDb2(url, dbname) {

        log(typeof(window.request))

        var options = {
            url: 'http://foo:foo34324@localhost:5984/todo',
            headers: {
                'Authorization': "Basic Zm9vOmZvbzM0MzI0=="
            }
        };

        function callback(error, response, body) {
            if (!error && response.statusCode == 200) {
                log("error: " + error)
                log("response: " + response)
                log("body: " + body)

                if (!error && response.statusCode == 200) {
                    console.log(body) // Print the google web page.
                }

            }
        }

        window.request(options, callback);

Modules.js

    newHoax.url = myPax;
    window.request = request;  // <-- added
    return newHoax;

Related to couchbase/couchbase-lite-java-listener#35

beta 3

Is there a way I can help upgrade the plugin to couchbase lite beta 3? Is it planned?

DB visible from lan on Android

Hi,

I've installed Couchbase-Lite-PhoneGap-Plugin on an Android project I'm currently working on.
I've tested the phone IP from my command line and got a reply from CBLite.

$ curl 192.168.1.108:5984/
{"couchdb":"Welcome","CBLite":"Welcome","version":"1.0.0-beta2"}

Is this the expected behavior? If so, is there any way to secure the BD for external access?

poor documentation for PG plugin?

There is just that TodoLite app but that is not enough as it does not explain how the code works. For example, how to create a new user or use hte old one. The code uses other modules (browserified) like pax etc but code isn't straight forward to read and understand and obviously you don't learn concepts and pitfalls by just looking at the code.
Please provide proper documentation other than the REST API as that also doesn't explain how to create a new local user and why a user is required etc.

CBL plugin crashes running on iOS device

The plugin crashes running on an iPad Air, for example with demo app https://github.com/couchbaselabs/TodoLite-PhoneGap. It is fine running on the simulator.

Would really appreciate a quick fix as my app (and the demo app) needs a camera to work properly.

Thread 1, Queue : com.apple.main-thread
Thread 2, Queue : com.apple.libdispatch-manager
Thread 3 com.apple.NSURLConnectionLoader, Queue : (null)
Thread 7 WebThread, Queue : (null)
Thread 8 JavaScriptCore::BlockFree, Queue : (null)
Thread 9 JavaScriptCore::Marking, Queue : (null)
Thread 10 CouchbaseLite, Queue : (null)
#0  0x0000000192fd00c0 in objc_retain ()
#1  0x00000001001c5c60 in -[CBL_Router(Handlers) do_GET:] ()
#2  0x00000001001c262c in -[CBL_Router route] at /Users/jenkins/jenkins/workspace/build_cblite_ios_100/couchbase-lite-ios/Source/CBL_Router.m:434
#3  0x00000001001c2e7c in -[CBL_Router run] at /Users/jenkins/jenkins/workspace/build_cblite_ios_100/couchbase-lite-ios/Source/CBL_Router.m:457
#4  0x00000001872805cc in __NSThreadPerformPerform ()
#5  0x00000001866bf7f4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#6  0x00000001866beb50 in __CFRunLoopDoSources0 ()
#7  0x00000001866bcde8 in __CFRunLoopRun ()
#8  0x00000001865fddd0 in CFRunLoopRunSpecific ()
#9  0x00000001871992c4 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#10 0x000000010013fee4 in -[CBL_Server runServerThread] at /Users/jenkins/jenkins/workspace/build_cblite_ios_100/couchbase-lite-ios/Source/CBL_Server.m:113
#11 0x000000018728040c in __NSThread__main__ ()
#12 0x0000000193727e1c in _pthread_body ()
#13 0x0000000193727d74 in _pthread_start ()
#14 0x0000000193725554 in thread_start ()
Thread 11 JavaScriptCore::BlockFree, Queue : (null)
Thread 12 JavaScriptCore::Marking, Queue : (null)
Thread 13 WebCore: CFNetwork Loader, Queue : (null)
Thread 14, Queue : (null)
Thread 15, Queue : CA::CG::Queue
2014-07-24 19:20:42.271 TodoLite[350:60b] Launching Couchbase Lite...
2014-07-24 19:20:42.282 TodoLite[350:60b] Couchbase Lite url = http://lite.couchbase./
2014-07-24 19:20:42.283 TodoLite[350:60b] [CDVTimer][cblite] 11.582971ms
2014-07-24 19:20:42.284 TodoLite[350:60b] [CDVTimer][TotalPluginStartup] 12.297988ms
2014-07-24 19:20:42.740 TodoLite[350:60b] Resetting plugins due to page load.
2014-07-24 19:20:42.873 TodoLite[350:60b] Finished load of: file:///var/mobile/Applications/2E3E9E74-D811-440B-A89A-E2EBE09B225A/TodoLite.app/www/index.html
2014-07-24 19:20:52.948 TodoLite[350:60b] THREAD WARNING: ['CBLite'] took '10011.031006' ms. Plugin should use a background thread.
(lldb) 

Don't embed the frameworks in the git repo

We shouldn't be embedding the frameworks inside the repo (in the lib directory.) It's inefficient to store big binary blobs in Git, and it hardcodes a specific version dependency, requiring us to update this repo every time we release a new version. (Or actually we haven't been, so developers complain that this repo is out of date.)

Instead there should either be a script to download the latest version of CBL, or the build instructions should require it to be copied into place (as with our demo apps.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.