Getting several "Error Domain=SQLite Code=23 "authorization denied""

696 views
Skip to first unread message

Frederic Yesid Peña Sánchez

unread,
Mar 11, 2014, 1:57:04 PM3/11/14
to mobile-c...@googlegroups.com
Hi

I'm getting several errors reported through Crashlytics about this:

if(!_db){

        _db = [servidor databaseNamed:@"pharmadvisor_mobile" error:&error]; <<< Line updating "error" variable

    }

    

    if (!_db || error){

            [NSException raise:@"Error creando DB" format:@"Error inesperado: %@", error];

    }

    

    if(_db)

        [self inicializarVistas];


    return _db;


The error complete is: 

Error Domain=SQLite Code=23 "authorization denied" UserInfo=0x155802e0 {NSLocalizedDescription=authorization denied}


Jens Alfke

unread,
Mar 11, 2014, 2:18:29 PM3/11/14
to mobile-c...@googlegroups.com

On Mar 11, 2014, at 10:57 AM, Frederic Yesid Peña Sánchez <freder...@gmail.com> wrote:

Error Domain=SQLite Code=23 "authorization denied" UserInfo=0x155802e0 {NSLocalizedDescription=authorization denied}

I’ve never heard of that SQLite error code before, but searching Google for SQLITE_AUTH, the second hit is this StackOverflow question where it occurs on iOS. Apparently this is caused by the process no longer having access to the database file due to iOS’s file encryption. Is it possible your code is being invoked when the device is locked?

—Jens

Frederic Yesid Peña Sánchez

unread,
Mar 11, 2014, 4:44:23 PM3/11/14
to mobile-c...@googlegroups.com
Well, I think that is correct, but so, how could i avoid the access while device being locked...

Looking on SO...


--
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/q8H3qzgYfHo/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/1E2F6779-3BD5-48D0-A62D-AB23BFADF68D%40couchbase.com.

For more options, visit https://groups.google.com/d/optout.

Frederic Yesid Peña Sánchez

unread,
Oct 1, 2014, 11:41:16 AM10/1/14
to mobile-c...@googlegroups.com
I'm still having these problems, seems related to having passcode on iPad and the app or replicator trying to access encrypted data.

There is some way to handle this yet documented???

Thanks


El martes, 11 de marzo de 2014 15:44:23 UTC-5, Frederic Yesid Peña Sánchez escribió:
Well, I think that is correct, but so, how could i avoid the access while device being locked...

Looking on SO...
2014-03-11 13:18 GMT-05:00 Jens Alfke <je...@couchbase.com>:

On Mar 11, 2014, at 10:57 AM, Frederic Yesid Peña Sánchez <freder...@gmail.com> wrote:

Error Domain=SQLite Code=23 "authorization denied" UserInfo=0x155802e0 {NSLocalizedDescription=authorization denied}

I’ve never heard of that SQLite error code before, but searching Google for SQLITE_AUTH, the second hit is this StackOverflow question where it occurs on iOS. Apparently this is caused by the process no longer having access to the database file due to iOS’s file encryption. Is it possible your code is being invoked when the device is locked?

—Jens

--
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/q8H3qzgYfHo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchbase+unsubscribe@googlegroups.com.

Jens Alfke

unread,
Oct 1, 2014, 5:10:46 PM10/1/14
to mobile-c...@googlegroups.com

On Oct 1, 2014, at 8:41 AM, Frederic Yesid Peña Sánchez <freder...@gmail.com> wrote:

I'm still having these problems, seems related to having passcode on iPad and the app or replicator trying to access encrypted data.

Sounds like the replicator is still running after the device locks. Do you have reliable steps to reproduce this?

A workaround is to loosen up the file protection attribute of the database directory so it remains accessible after the device locks. Set the CBLManagerOptions.fileProtection to NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication when creating the CBLManager.

—Jens

Ibrahim

unread,
Jul 21, 2015, 6:12:32 AM7/21/15
to mobile-c...@googlegroups.com
I had the same problem happens with me, i was able to reproduce by editing scheme, from options select `launch due to background fetch event`, then run the app while device is locked, trying to change fileProtection to NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication didn't help, even after i switched to ForestDB i see this error `WARNING: ForestDB error FORESTDB ERROR -2`

Jens Alfke

unread,
Jul 21, 2015, 12:34:29 PM7/21/15
to mobile-c...@googlegroups.com

On Jul 21, 2015, at 3:12 AM, Ibrahim <a...@phonidex.com> wrote:

I had the same problem happens with me, i was able to reproduce by editing scheme, from options select `launch due to background fetch event`, then run the app while device is locked, trying to change fileProtection to NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication didn't help, even after i switched to ForestDB i see this error `WARNING: ForestDB error FORESTDB ERROR -2`

Background-fetch support is issue #138. Pasin’s done some work on it, but file access permissions are a problem. The sync protocol is interactive, not just a simple download, so it requires that the database be accessible during the pull.

—Jens

j...@mangohealth.com

unread,
Sep 11, 2015, 8:54:17 PM9/11/15
to Couchbase Mobile
We are running into this issue when trying to read data out of CouchbaseLite from the Apple Watch while the iPhone is locked.  CBLManagerOption.fileProtection is not able to get around the issue.

For some reason, we are able to connect to Couchbase on the first instance after installing the app while the phone is locked, but subsequent attempts give the "authorization denied" message.

Has a work around been discovered?  Does this make CouchbaseLite fundementally incompatible with Apple Watch?

Jens Alfke

unread,
Sep 11, 2015, 10:13:43 PM9/11/15
to mobile-c...@googlegroups.com

> On Sep 11, 2015, at 5:20 PM, j...@mangohealth.com wrote:
>
> For some reason, we are able to connect to Couchbase on the first instance after installing the app while the phone is locked, but subsequent attempts give the "authorization denied" message.

Is this really the same issue? What is the exact NSError, or logged warning, that you get?

(Also, why would it matter if the phone is locked, since the app is running on the watch? I'm assuming this is a WatchOS 2.0 app, right?)

--Jens

j...@mangohealth.com

unread,
Sep 16, 2015, 5:17:34 PM9/16/15
to Couchbase Mobile
The issue we were running into was "authorization denied" when the Watch was attempting to access Couchbase on the Phone while it was locked.

Our app is currently a WatchOS 1.0 app, so the architecture is a bit unintuitive.  There is a proxy app on the phone that represents the watch app.  We are using a mechanism that allows this proxy app to communicate directly with our iPhone app.  The issue was cropping up when someone would access the Watch app while the main both the main iPhone app was out of memory and the Phone itself was locked.

However, tentatively we may have come up with a fix.  The combination of changing the CBLManagerOption.fileProtection to NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication as well as adding both the parent app and the watch proxy app to a single AppGroup seems to have resolved the issue.  Frankly, I don't understand why using the AppGroup has fixed the issue, since it was the parent app the was launching Couchbase not the Watch, but somehow the Watch permissions must be transferring to the parent app in this instance.
Reply all
Reply to author
Forward
0 new messages