Syncing between IOS and Android App (both made using cordova) and couchbase lite plugin

180 views
Skip to first unread message

Vinay Bhinde

unread,
Dec 4, 2014, 6:40:20 AM12/4/14
to mobile-c...@googlegroups.com
Hello All,

I would like to tell you what we have done till now...

I am using couchbase lite on IOS and android along with sync gateway. For authentication i use Nodejs api which is running on the same host as the sync gateway but on different port.
I call nodejs api when user taps login button which gets me a session from gateway and i return the session cookie header in response from nodejs to client. Now while setting up replication properties in app for sync i explicitly define "header" object with "Cookie" property so that CBLite recognizes the session and user while making calls to SG.

I do the same in case of IOS app. The replication and syncing runs fine on android but i am facing issues on IOS. The issue is that even if i create a document with channel A and user A signed in on android, user B with access to channel B using the app on IOS and logged in receives that document which should not be the case. I have doubts if the session cookie i generate is used by CBLite for making calls to Sg because the user on ios is receiving all the documents regardless of any channel. 

Any help is appreciated.

ajres

unread,
Dec 4, 2014, 11:16:27 AM12/4/14
to mobile-c...@googlegroups.com
Can you show us the replication URLS's you are using in your mobile code, your sync_gateway.json config and a sample doc.

One issue you could check for is that your replication URL's are pointing to port 4984 (default user API) and not 4985 (default Admin API).

Andy

Traun Leyden

unread,
Dec 4, 2014, 1:37:10 PM12/4/14
to mobile-c...@googlegroups.com
Can you post your sync gateway config?

Also, I would suggest disabling guest access, so that way you know whether it's using the session cookie or not (if it's not, it will get an error trying to do a replication)

--
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/4828e271-b45f-4e3a-8268-753b531675b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vinay Bhinde

unread,
Dec 5, 2014, 7:43:56 AM12/5/14
to mobile-c...@googlegroups.com

my config json file

{
 
"log": ["CRUD", "REST+"],
 
"databases": {
 
"budgetappdb": {
 
"server": "http://localhost:8091",
 
"bucket": "sync_gateway",
 
"users": {
 
"GUEST": {"disabled" : false}
 
},
 
"sync":`function(doc,oldDoc){if (doc._deleted) {requireUser(oldDoc.channels);return;}if(!doc.channels){throw({forbidden: "Missing required properties"});}if(oldDoc==null){requireUser(doc.channels)}else{requireUser(oldDoc.channels);}channel(doc.channels);access(doc.channels,doc.channels);}`
 
}
 
}
}


Replicate request header on IOS

{"target":"budgetappdb","headers":{"Cookie":"SyncGatewaySession=238aa5d0b66d9588559756eb91c5427509a8c69a"},"source":{"url":"http://192.168.1.14:4984/budgetappdb","auth":{"name":"vinay"}},"continuous":true}




Currently even though i login from IOS and Android with same credentials, i do not get documents which i create on android on IOS but the reverse works fine. Please ignore the original post regarding ios device receiving all documents.Simply stating there is no pull at ios..just the push.

i am posting a screenshot of sync gateway server logs 






 

Vinay Bhinde

unread,
Dec 5, 2014, 8:16:27 AM12/5/14
to mobile-c...@googlegroups.com
OK UPDATE

i disabled guest access from my config file and restarted SG. What happened was that on IOS the first time after installing the app and logging in i am able to successfully set the session cookie in cblite but once i close the app and restart it my requests to SG from CBLite throw "Login required" error.

That means my cookie isn't being set once i restart my app. This is despite the fact that i send session id manually in the replicate headers object. Why isn't SG authenticating the request despite of it containing a cookie in header ??

 

J. Chris Anderson

unread,
Dec 5, 2014, 10:37:36 AM12/5/14
to mobile-c...@googlegroups.com

Jens Alfke

unread,
Dec 5, 2014, 12:23:30 PM12/5/14
to mobile-c...@googlegroups.com
The logs show some requests being made on the admin port — see "(ADMIN)" in the logs. That implies you have a client using the admin port, which is generally a bad idea.
(Please don't post logs as screenshots. Besides the wasted bandwidth it also makes it impossible to copy and paste text from them. IIRC the Windows DOS app is still brain-dead about copy/paste but there are good alternative terminal apps.)

> {"target":"budgetappdb","headers":{"Cookie":"SyncGatewaySession=238aa5d0b66d9588559756eb91c5427509a8c69a"},"source":{"url":"http://192.168.1.14:4984/budgetappdb","auth":{"name":"vinay"}},"continuous":true}

CBL doesn't support a "name" sub-property of "auth", so your authentication is being ignored and it's connecting as guest, as Traun said. (Again, you can see this in the Gateway logs because the iOS requests don't say "(as vinay)" at the end.)

(Looking through the CouchDB docs, it doesn't seem to support "name" auth either. Where did you get this from? I'm wondering if there are incorrect docs somewhere, or if this is actually a supported CouchDB property that I just haven't found documentation for.)

Instead, put the username in the URL, i.e.
"source": "http://vi...@192.168.1.14:4984/budgetappdb"
you may also need the password if it's not already in the application's keychain:
"source": "http://vinay:mypas...@192.168.1.14:4984/budgetappdb"

—Jens

Jens Alfke

unread,
Dec 5, 2014, 12:25:44 PM12/5/14
to mobile-c...@googlegroups.com

On Dec 5, 2014, at 5:16 AM, Vinay Bhinde <vin...@gmail.com> wrote:

That means my cookie isn't being set once i restart my app. This is despite the fact that i send session id manually in the replicate headers object. Why isn't SG authenticating the request despite of it containing a cookie in header ??

If you are putting a "Cookie:" header in a custom-headers object, it is unfortunately ignored (#532).

—Jens

Vinay Bhinde

unread,
Dec 6, 2014, 12:22:35 AM12/6/14
to mobile-c...@googlegroups.com


On Friday, 5 December 2014 22:55:44 UTC+5:30, Jens Alfke wrote:

If you are putting a "Cookie:" header in a custom-headers object, it is unfortunately ignored (#532).

—Jens

But the same cookie:header in custom-headers works very well in android. It wasn't previously but then i updated the plugin version from 1.0.0 to 1.0.3 and it works. Furthermore in iOS too this thing works for the very first time (i.e it accepts the cookie header and authenticates )  but thereafter after restarting my app even though i send the cookie, CBLite doesn't use it and my login fails with SG.

Vinay Bhinde

unread,
Dec 6, 2014, 1:14:01 AM12/6/14
to mobile-c...@googlegroups.com


On Friday, 5 December 2014 22:53:30 UTC+5:30, Jens Alfke wrote:
The logs show some requests being made on the admin port — see "(ADMIN)" in the logs. That implies you have a client using the admin port, which is generally a bad idea.
(Please don't post logs as screenshots. Besides the wasted bandwidth it also makes it impossible to copy and paste text from them. IIRC the Windows DOS app is still brain-dead about copy/paste but there are good alternative terminal apps.)

Those ADMIN port requests are being made by me only. I had just kept a client open in order to check if the channels assignment to docs was as it should be. I wasn't modifying anything using admin interface. And yes i will be switching to some other console app for windows rather then copy/pasting screenshots.
 

> {"target":"budgetappdb","headers":{"Cookie":"SyncGatewaySession=238aa5d0b66d9588559756eb91c5427509a8c69a"},"source":{"url":"http://192.168.1.14:4984/budgetappdb","auth":{"name":"vinay"}},"continuous":true}

CBL doesn't support a "name" sub-property of "auth", so your authentication is being ignored and it's connecting as guest, as Traun said. (Again, you can see this in the Gateway logs because the iOS requests don't say "(as vinay)" at the end.) 
 
(Looking through the CouchDB docs, it doesn't seem to support "name" auth either. Where did you get this from? I'm wondering if there are incorrect docs somewhere, or if this is actually a supported CouchDB property that I just haven't found documentation for.)


Ok that was error on my part..i found it somewhere in a demo app code for phonegap but now i can't trace the source for it. Nevertheless i removed the "name" property along with the "auth" property and build my app again. Issue persists :( . Below is my current flow as it happens.

-Install app to android
-signup with username-vinay,pass-vinay
-session created on SG
--i can see my _replicate calls with session cookie set in header and SG accepts my user login

-switch to iOS
-login with same credentials
- a new session for same user created on SG
--i can see my _replicate calls with session cookie set in header and SG accepts my user login
--enter a new document in iOS app
-new document is replicated in ANDROID


-similarly enter a new document in android IT IS NOT REPLICATED IN iOS even though i am currently logged in
-restart iOS app and now CBLite does not send my cookie...login fails entirely on SG thereafter all the times.


 
Instead, put the username in the URL, i.e.
        "source": "http://vi...@192.168.1.14:4984/budgetappdb"
you may also need the password if it's not already in the application's keychain:
        "source": "http://vinay:mypassword@192.168.1.14:4984/budgetappdb"

—Jens

I have a doubt here..guide me if i am doing something stupid but do i need to pass username and password as u wrote above when i am authenticating by sending session cookie ? 

Vinay Bhinde

unread,
Dec 6, 2014, 1:23:02 AM12/6/14
to mobile-c...@googlegroups.com
My logs from SG server initially which show the user "vinay" is logged in from both devices and is polling for changes, still no pull iOS if we push from android.



11:39:29.693003 HTTP:  #062: POST /budgetappdb/_changes  (as vinay)
11:40:42.719305 HTTP:  #063: POST /budgetappdb/_changes  (as vinay)
11:41:32.607294 HTTP:  #064: GET /budgetappdb/_changes?feed=websocket  (as vinay
)
11:41:57.293762 HTTP:  #065: POST /budgetappdb/_changes  (as vinay)
11:43:13.627606 HTTP:  #066: POST /budgetappdb/_changes  (as vinay)

Vinay Bhinde

unread,
Dec 6, 2014, 6:16:40 AM12/6/14
to mobile-c...@googlegroups.com
Also additionally i am receiving these errors when i enable logs on iOS CbLite 


16:39:36.725 CBLSocketChangeTracker[0x135bae50 budgetappdb]: Connection error #1, retrying in 2.0 sec: The operation couldn’t be completed. (CBLChangeTracker error 587.)
16:39:38.928 WARNING*** : JSON error parsing _changes feed: parse error: client cancelled parse via callback return value


16:39:38.929 CBLSocketChangeTracker[0x135bae50 budgetappdb]: Connection error #1, retrying in 2.0 sec: The operation couldn’t be completed. (CBLChangeTracker error 587.)
16:39:41.152 WARNING*** : JSON error parsing _changes feed: parse error: client cancelled parse via callback return value


16:39:41.153 CBLSocketChangeTracker[0x135bae50 budgetappdb]: Connection error #1, retrying in 2.0 sec: The operation couldn’t be completed. (CBLChangeTracker error 587.)
16:39:43.356 WARNING*** : JSON error parsing _changes feed: parse error: client cancelled parse via callback return value


I kind of think the above warning is the the thing that is stopping new documents to be pulled into iOS client...as far as i understand it is referring to the fact that json in my document is bugged and not parsed by CBLite and that it needs linting right ?
 

Jens Alfke

unread,
Dec 6, 2014, 11:25:07 AM12/6/14
to mobile-c...@googlegroups.com
On Dec 5, 2014, at 9:22 PM, Vinay Bhinde <vin...@gmail.com> wrote:

But the same cookie:header in custom-headers works very well in android.

That's because the bug I referred to only occurs on iOS. (The system NSURLConnection class ignores 'Cookie' headers explicitly set by app code.)

Furthermore in iOS too this thing works for the very first time (i.e it accepts the cookie header and authenticates )  but thereafter after restarting my app even though i send the cookie, CBLite doesn't use it and my login fails with SG.

Well let's see. Looking back at your first message, you say you're using custom auth, and your auth server is on the same host as the SG. In that case you shouldn't need to do anything special as far as setting cookie headers, because the OS cookie store will send the cookie set by your auth server when it sends requests to the SG. (Since IIRC cookies are not port-specific.)

What you are going to have to do is keep track of when the cookie expires, since CBL doesn't know how to re-authenticate. If the cookie your auth returns is non-persistent, that might explain why things stop working after relaunch. You'd need to re-authenticate with your server on every launch before starting replication.

I kind of think the above warning is the the thing that is stopping new documents to be pulled into iOS client...as far as i understand it is referring to the fact that json in my document is bugged and not parsed by CBLite and that it needs linting right ?

That warning ("JSON error parsing _changes feed") means CBL is having trouble parsing the list of change sent by the SG. There have been other recent reports of this too from other users. It's being tracked as issue #541.

But yes, this is preventing CBL from pulling changes.

I have an idea about what might be causing #541 and I can check in an experimental fix soon.

—Jens

Vinay Bhinde

unread,
Dec 6, 2014, 11:35:44 AM12/6/14
to mobile-c...@googlegroups.com

Thanks for the help and all the pointers... They are really useful for me.

The documentation regarding custom authentication says in order for CBL to use the cookie returned by auth server automatically to make calls to SG, the SG and Auth server should be running on the same port and not just the same host.

That isn't the case with my environment. They run on same host but on different ports. And i tried checking if CBL used the cookie that i return from nodejs server but it doesn't use it and i get login error on SG calls. So i had to set it manually. And it works atleast for the first time.

Vinay Bhinde

unread,
Dec 6, 2014, 11:40:17 AM12/6/14
to mobile-c...@googlegroups.com
The default cookie expiry time is 24 hours so i don't think that might be the issue on relaunch. I am yet to solve that bug too. Some unknown issue which is yet to be traced by me it seems.

Vinay Bhinde

unread,
Dec 9, 2014, 2:23:11 AM12/9/14
to mobile-c...@googlegroups.com
That warning ("JSON error parsing _changes feed") means CBL is having trouble parsing the list of change sent by the SG. There have been other recent reports of this too from other users. It's being tracked as issue #541.

But yes, this is preventing CBL from pulling changes.

I have an idea about what might be causing #541 and I can check in an experimental fix soon.

—Jens

I checked out issue #541 and it is closed down. They solved it by removing the couchbase dependencies and adding them again. I am still facing that issue and currently my sync feature is rendered useless because of ios client not being able to pull. Any short term fix will be really helpful.

Jens Alfke

unread,
Dec 9, 2014, 11:33:43 AM12/9/14
to mobile-c...@googlegroups.com

On Dec 8, 2014, at 11:23 PM, Vinay Bhinde <vin...@gmail.com> wrote:

I checked out issue #541 and it is closed down. They solved it by removing the couchbase dependencies and adding them again. I am still facing that issue and currently my sync feature is rendered useless because of ios client not being able to pull. Any short term fix will be really helpful.

More importantly, they removed CBL 1.0 and added 1.0.3, i.e. they upgraded the version.
Check what version of CBL you have in your plugin, by doing a "GET /" request. I know that until recently the Cordova plugin repository had an old version.

—Jens

Vinay Bhinde

unread,
Dec 10, 2014, 5:04:00 AM12/10/14
to mobile-c...@googlegroups.com
More importantly, they removed CBL 1.0 and added 1.0.3, i.e. they upgraded the version.
Check what version of CBL you have in your plugin, by doing a "GET /" request. I know that until recently the Cordova plugin repository had an old version.

—Jens


I was doing a mistake which was falsely making me believe that CBLite was updated but it wasn't actually. What i was doing it that i was issuing cordova add plugin command for cblite without removing the previous version. This isn't the correct way because though in the plugin files you will find the new version number, it doesn't update the source files. I got to know about this when i completely removed the older plugin and installed the newer one (i.e 1.0.3).

This gave good as well as bad news.

Good news is that now when i build and run the app in ios simulator and check the logs the _changes feed parse error is no longer occuring !!

Bad news is that after updating my cordova project with cblite 1.0.3 it isn't letting me archive my app and generate a IPA file. It shows me following errors when failing to archive and hence i have no way of generating the actual ios app file.






Jens Alfke

unread,
Dec 10, 2014, 11:32:13 AM12/10/14
to mobile-c...@googlegroups.com, J Chris Anderson

On Dec 10, 2014, at 2:04 AM, Vinay Bhinde <vin...@gmail.com> wrote:

Bad news is that after updating my cordova project with cblite 1.0.3 it isn't letting me archive my app and generate a IPA file. It shows me following errors when failing to archive and hence i have no way of generating the actual ios app file.

The clue must be in the warnings saying "Ignoring file _____" — if it's skipping the CBL libraries that definitely explains the later link errors.

Unfortunately the screenshot cuts off the messages. It's much better to paste errors as text than images. Go to the log/report navigator, select the build, and copy the errors from there.

—Jens

Vinay Bhinde

unread,
Dec 11, 2014, 12:34:58 AM12/11/14
to mobile-c...@googlegroups.com, jch...@couchbase.com


On Wednesday, 10 December 2014 22:02:13 UTC+5:30, Jens Alfke wrote:
The clue must be in the warnings saying "Ignoring file _____" — if it's skipping the CBL libraries that definitely explains the later link errors.

Unfortunately the screenshot cuts off the messages. It's much better to paste errors as text than images. Go to the log/report navigator, select the build, and copy the errors from there.

—Jens

Here are the complete error logs from Xcode


Build target BudgetApp


Ld /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/IntermediateBuildFilesPath/BudgetApp.build/Release-iphoneos/BudgetApp.build/Objects-normal/arm64/BudgetApp normal arm64
    cd
/Users/mac/Desktop/BudgetApp/platforms/ios
   
export IPHONEOS_DEPLOYMENT_TARGET=6.0
   
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
   
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -L/Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/BuildProductsPath/Release-iphoneos -L/Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap -F/Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/BuildProductsPath/Release-iphoneos -filelist /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/IntermediateBuildFilesPath/BudgetApp.build/Release-iphoneos/BudgetApp.build/Objects-normal/arm64/BudgetApp.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/BuildProductsPath/Release-iphoneos/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AssetsLibrary /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/BuildProductsPath/Release-iphoneos/libCordova.a -framework CoreGraphics -framework MobileCoreServices -lCBLJSViewCompiler /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLite.a /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLiteListener.a /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/JavaScriptCore.a -lsqlite3 -lstdc++ -licucore -lz -framework Security -framework CFNetwork -framework SystemConfiguration -Xlinker -dependency_info -Xlinker /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/IntermediateBuildFilesPath/BudgetApp.build/Release-iphoneos/BudgetApp.build/Objects-normal/arm64/BudgetApp_dependency_info.dat -o /Users/mac/Library/Developer/Xcode/DerivedData/BudgetApp-elzdmxbcbgxqlhfquihazirquizr/Build/Intermediates/ArchiveIntermediates/BudgetApp/IntermediateBuildFilesPath/BudgetApp.build/Release-iphoneos/BudgetApp.build/Objects-normal/arm64/BudgetApp


ld
: warning: ignoring file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/libCBLJSViewCompiler.a, missing required architecture arm64 in file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/libCBLJSViewCompiler.a (3 slices)
ld
: warning: ignoring file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLite.a, missing required architecture arm64 in file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLite.a (3 slices)
ld
: warning: ignoring file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLiteListener.a, missing required architecture arm64 in file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLiteListener.a (3 slices)
ld
: warning: ignoring file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/JavaScriptCore.a, missing required architecture arm64 in file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/JavaScriptCore.a (3 slices)
Undefined symbols for architecture arm64:
 
"_OBJC_CLASS_$_CBLManager", referenced from:
      objc
-class-ref in CBLite.o
 
"_CBLRegisterJSViewCompiler", referenced from:
     
-[CBLite launchCouchbaseLite] in CBLite.o
ld
: symbol(s) not found for architecture arm64
clang
: error: linker command failed with exit code 1 (use -v to see invocation)


Also i initially thought this to be some error from my side so what i did was that i created a simple blank cordova app and added cblite 1.0.3 phonegap plugin to it along with ios platform and then tried to archive it from xcode. Still it fails with above errors.
 

Jens Alfke

unread,
Dec 11, 2014, 12:46:18 PM12/11/14
to mobile-c...@googlegroups.com, J Chris Anderson
Here's the problem:

ld: warning: ignoring file /Users/mac/Desktop/BudgetApp/platforms/ios/BudgetApp/Plugins/com.couchbase.lite.phonegap/CouchbaseLite.a, missing required architecture arm64 in file

Looks like the plugin was built 32-bit-only, but your app target is configured to build both 32- and 64-bit.

i created a simple blank cordova app and added cblite 1.0.3 phonegap plugin to it along with ios platform and then tried to archive it from xcode. Still it fails with above errors.

That's weird! Chris … ?

—Jens

Jens Alfke

unread,
Dec 11, 2014, 12:57:04 PM12/11/14
to mobile-c...@googlegroups.com, jch...@couchbase.com
I asked Chris about this. The Cordova plugin just copies the 1.0.3 libraries, so they must be 64-bit. He suspects that you're not actually building with the 1.0.3 libraries for some reason. There might be some kind of caching problem in your development environment -- did you upgrade from an earlier plugin?

(Someone else posted here a few days ago about upgrading being a bit tricky; IIRC they had to explicitly delete the old plugin before installing the new one. Check the archives.)

--Jens

Vinay Bhinde

unread,
Dec 11, 2014, 1:02:06 PM12/11/14
to mobile-c...@googlegroups.com

I had that problem earlier...but i got to know about it and then i tried a completely fresh install of the Cordova plugin..still it fails.

Further more as i said i went ahead and created a blank cordova app and added just cblite 1.0.3 and ios platform.. Nothing else to make sure there isn't any interference. Still it fails. I would recommend jchris to check this test simple reduced test case and see if he too faces this issue.

Stuck on making sync work on ios for a few days now. Working on tight deadlines :(

Thanks
Vinay Bhinde

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/nEvhKKuednw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/c15563b8-b057-4ec0-b259-2eb216f4c98e%40googlegroups.com.
Message has been deleted

Jens Alfke

unread,
Dec 11, 2014, 2:06:33 PM12/11/14
to mobile-c...@googlegroups.com

> On Dec 11, 2014, at 10:02 AM, Vinay Bhinde <vin...@gmail.com> wrote:
>
> Further more as i said i went ahead and created a blank cordova app and added just cblite 1.0.3 and ios platform.. Nothing else to make sure there isn't any interference. Still it fails. I would recommend jchris to check this test simple reduced test case and see if he too faces this issue.
>
> Stuck on making sync work on ios for a few days now. Working on tight deadlines :(

Sorry about that! Since it looks like you're building in Xcode, you should be able to work around this by editing the target's build settings to make it 32-bit only. The setting is near the top of the list, "Architectures" — change the value from "Standard" to "armv7".

(Not having a 64-bit app shouldn't cause problems. It'll still run on 64-bit devices.)

—Jens

Jens Alfke

unread,
Dec 11, 2014, 6:40:10 PM12/11/14
to mobile-c...@googlegroups.com


On Thursday, December 11, 2014 10:02:06 AM UTC-8, Vinay Bhinde wrote:

I had that problem earlier...but i got to know about it and then i tried a completely fresh install of the Cordova plugin..still it fails.

Further more as i said i went ahead and created a blank cordova app and added just cblite 1.0.3 and ios platform.. Nothing else to make sure there isn't any interference. Still it fails. I would recommend jchris to check this test simple reduced test case and see if he too faces this issue.


Our engineer Pasin just verified that he can use the directions on our website to successfully build and run an iOS PhoneGap/Cordova app. Is what you're doing similar? Maybe you're getting the plugin from a different source?

--Jens

Vinay Bhinde

unread,
Dec 12, 2014, 7:08:25 AM12/12/14
to mobile-c...@googlegroups.com


On Friday, 12 December 2014 05:10:10 UTC+5:30, Jens Alfke wrote:

Our engineer Pasin just verified that he can use the directions on our website to successfully build and run an iOS PhoneGap/Cordova app. Is what you're doing similar? Maybe you're getting the plugin from a different source?

--Jens

I went to the link of the documentation for phonegap and followed the steps mentioned there. It fails for me. Here are the steps i followed

-Add a new cordova project 
cordova create hello com.cblite.hello HelloWorld

-add ios platform
cordova platform add ios

-add cblite plugin 
-open xcode and archive and it again ignores JavascriptCore.a file and gives me 22 errors.

One thing i would like to mention that if one goes by the steps that are written in your documentation, the Couchbase lite phonegap plugin version you get is in your cordova application is 1.0.2 and not 1.0.3 which you get when you fetch from cordova's plugin registry..why so ?

Then what i did to get it running was i removed the standard architecture in build settings as you described and just put armv7 there instead. It worked and i was able to archive my app but i have over 161 warnings of which i am posting some below...i wanted to know that are all these warnings avoidable and safe to go ahead ?

warning: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPDataResponse.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPFileResponse.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPAuthenticationRequest.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPConnection.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPMessage.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/HTTPServer.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/DDLog.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/DDNumber.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/DDRange.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/CBLListener.o unable to open object file
warning
: (armv7) /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/build/CouchbaseLite.build/Release-iphoneos/Listener iOS Library.build/Objects-normal/armv7/CBLHTTPServer.o unable to open object file

Here is where i am currently with the progress

- Ios client was not able to pull - SOLVED by using plugin version 1.0.2 32 bit architecture (still not using 1.0.3)

- _replicate calls from an IOS client with session cookie fail to authenticate with SG after restarting the app - UNSOLVED (cookie doesn't get expired..i checked it)

-archive my ios cordova app from xcode using plugin version 1.0.3 for 64 bit architecture - UNSOLVED (gives linker errors)




Vinay Bhinde

unread,
Dec 12, 2014, 9:24:42 AM12/12/14
to mobile-c...@googlegroups.com
Also i tried updating the plugin to 1.0.3 but i facing issues in posting documents to cblite and i guess it is because of some difference between plugin version. I used 1.0.0 all this time. So i will be going with 1.0.2 for now as it works with my current code.

The only major issue right now is that i cannot figure out why does my ios client fail to authenticate with SG inspite of session cookie being valid and not expired. And as there is no authentication there is no sync stuff. Any help for where should i check and what's going wrong  (any specific logs so that i can search to find if cblite requests take my cookie along when they call SG) because for the first time client successfully authenticates.

After restart all SG shows me are 401 auth errors which means cblite calls fail authentication.

Jens Alfke

unread,
Dec 12, 2014, 11:55:39 AM12/12/14
to mobile-c...@googlegroups.com
On Dec 12, 2014, at 6:24 AM, Vinay Bhinde <vin...@gmail.com> wrote:

The only major issue right now is that i cannot figure out why does my ios client fail to authenticate with SG inspite of session cookie being valid and not expired.

Looking back through this thread, I think it's the bug I mentioned about the "Cookie" header being ignored when you set it as a custom header in the _replicate call. But it's hard to tell with all the back-and-forth.

Have you filed an issue? I can't find one. That's a better way to track this than email discussion.

Any help for where should i check and what's going wrong  (any specific logs so that i can search to find if cblite requests take my cookie along when they call SG) because for the first time client successfully authenticates.

See if you can sniff the HTTP traffic between app and server. Then you can see what Set-Cookie headers the server sends and what Cookie headers the app sends.

A proxy like nginx in front of the Sync Gateway should be able to do this, or you can run a debugging proxy like Charles on your client network and configure your device (or simulator) to connect through it.

—Jens

Vinay Bhinde

unread,
Dec 12, 2014, 12:41:46 PM12/12/14
to mobile-c...@googlegroups.com


On Friday, 12 December 2014 22:25:39 UTC+5:30, Jens Alfke wrote:

Have you filed an issue? I can't find one. That's a better way to track this than email discussion.

Filed issue #552 



See if you can sniff the HTTP traffic between app and server. Then you can see what Set-Cookie headers the server sends and what Cookie headers the app sends.

A proxy like nginx in front of the Sync Gateway should be able to do this, or you can run a debugging proxy like Charles on your client network and configure your device (or simulator) to connect through it.

—Jens

Will try debugging network activity with charles and see if i find something. 
Reply all
Reply to author
Forward
0 new messages