Need to pull documents from remote bucket to empty local database initially


I am new to use couchbase on iOS env.

I have installed couchbase on cloud and use couchbase lite to develop iOS app for my company.
I used couchbase’s samples (ToDoLite and GrocerySync) as references So far My code runs fine on my Mac. I can pull data remotely until I reset the iOS simulator, suddenly , my code can not pull documents from remote cloud any more…I know reseting simulator will clean the local database. (this is part of the test since the app will be running freshly on another iPhone)

I used GrocerySync and ToDoLite samples to test…After resetting iOS simulator, GrocerySync can still pull data from my remote could but ToDoLite couldn’t.
(GrocerySync does not use CBLModel, authentication)

I searched and read some couchbase forums and tried to use bucket shadowing seems not working. The other solution is to preload db to bundle…that is not doable for me since our content is dynamic (i wish i can use bundle)

Could any one guide me how to pull remote bucket documents to local empty database?

appreciated for your help.

It sounds like an authentication problem — resetting the simulator will remove any saved session cookies, or passwords saved in the keychain.

What’s the error you get back from the replicator? If this is an auth problem it’ll probably be a code 401.

Does your app have code to handle auth errors and ask the user for credentials to log in? (You didn’t say what form of login your server needs.)

(Also, I’m not sure why you’re bringing up bucket shadowing … that’s not related to auth or replication at all.)

Hi Jens,
You were right! It is authentication issue…

I temporally removed authentication in my code and now I can pull existing documents from cloud to empty local db. It is not the final solution but I need to finish demo work this week…

With authentication, I think the error is 401. I will try it with auth after I present demo app this week . I will try putting back auth code and post the error later.

RE: bucket shadowing, you were right again… I just couldn’t figure it out at that time and tried all kind of ways to pull data…

Again, thanks so much for your prompt reply.