Crash When app goes background twice in iOS.

122 views
Skip to first unread message

Raj Shekhar

unread,
Feb 5, 2016, 7:23:08 AM2/5/16
to Couchbase Mobile

My App crashed when it goes background twice . This issue has been raised by someone else on github forum but the issue is still open :

https://github.com/couchbase/couchbase-lite-ios/issues/1006 


Due to which I am unable to upload build to apple store.They will reject my app if any crash found.Please give me right direction so that i can rectify this issue.I am using cblite enterprise 1.2 iOS.


Also I have also used 'beginBackgroundTaskWithExpirationHandler' in my app.


Below are my logs :


*** ASSERTION FAILED: _bgTask == UIBackgroundTaskInvalid

2016-02-05 17:36:31.459 My****[9486:3410479] *** Assertion failure in -[MYBackgroundMonitor beginBackgroundTaskNamed:](), /Users/jenkins/jenkins/workspace/couchbase-lite-ios-builds/couchbase-lite-ios/vendor/MYUtilities/MYBackgroundMonitor.m:65

2016-02-05 17:36:31.4 *** ASSERTION FAILED: _bgTask == UIBackgroundTaskInvalid

2016-02-05 17:36:31.459 X[9486:3410479] *** Assertion failure in -[MYBackgroundMonitor beginBackgroundTaskNamed:](), /Users/jenkins/jenkins/workspace/couchbase-lite-ios-builds/couchbase-lite-ios/vendor/MYUtilities/MYBackgroundMonitor.m:65

2016-02-05 17:36:31.463 My****[9486:3410479] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_bgTask == UIBackgroundTaskInvalid'

*** First throw call stack:

(0x25b5f86b 0x37512dff 0x25b5f741 0x268ef307 0xfdf493 0xfa745f 0xfe1a17 0xfe17fb 0x25b13ffd 0x25b13a0b 0x25b137e1 0x25b67ac3 0x25a7504b 0x2685e317 0x29f0d9ff 0x29fc9451 0x29f0d863 0x29f0de37 0x29f1b4ab 0x29f1b405 0x29f08637 0x29f08327 0x2dcaea75 0x2dcc9ccd 0x2dcc9fb9 0x25b22827 0x25b22417 0x25b2077f 0x25a731e9 0x25a72fdd 0x2ed17af9 0x29cd817d 0x2f9145 0x37c3d873)

libc++abi.dylib: terminating with uncaught exception of type NSException63 My****[[9486:3410479] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_bgTask == UIBackgroundTaskInvalid'

*** First throw call stack:

(0x25b5f86b 0x37512dff 0x25b5f741 0x268ef307 0xfdf493 0xfa745f 0xfe1a17 0xfe17fb 0x25b13ffd 0x25b13a0b 0x25b137e1 0x25b67ac3 0x25a7504b 0x2685e317 0x29f0d9ff 0x29fc9451 0x29f0d863 0x29f0de37 0x29f1b4ab 0x29f1b405 0x29f08637 0x29f08327 0x2dcaea75 0x2dcc9ccd 0x2dcc9fb9 0x25b22827 0x25b22417 0x25b2077f 0x25a731e9 0x25a72fdd 0x2ed17af9 0x29cd817d 0x2f9145 0x37c3d873)

libc++abi.dylib: terminating with uncaught exception of type NSException

Jens Alfke

unread,
Feb 5, 2016, 3:19:57 PM2/5/16
to mobile-c...@googlegroups.com

> On Feb 5, 2016, at 4:23 AM, Raj Shekhar <rajshe...@gmail.com> wrote:
>
> My App crashed when it goes background twice . This issue has been raised by someone else on github forum but the issue is still open :
>
> https://github.com/couchbase/couchbase-lite-ios/issues/1006

Sorry, it looks like this issue fell between the cracks! I will try to investigate it later today.

> Also I have also used 'beginBackgroundTaskWithExpirationHandler' in my app.

Would it be possible to temporarily comment out your background task, and see if the crash still reproduces? That will help isolate what’s going wrong.

—Jens

Raj Shekhar

unread,
Feb 6, 2016, 3:39:39 AM2/6/16
to Couchbase Mobile
Hi Jens thanks for quick reply.I commented out my background task in my code but it still crash.I am seeing that my third party library is also using 'beginBackgroundTaskWithExpirationHandler' that I cant comment.

On the other hand I have another app that is also using cblite in which there is no code related to 'beginBackgroundTaskWithExpirationHandler' and it dint crashed.I am unable to figure out this problem.

Raj Shekhar

unread,
Feb 9, 2016, 12:57:11 PM2/9/16
to Couchbase Mobile

Hi Jens I updated your patch number 1108 https://github.com/couchbase/couchbase-lite-ios/pull/1108 from master branch to fix above issue.Now its working fine.Thanks a lot by resolving this issue on a quick notice.
Previously the version I was using was 'release/1.2' from github. Right now I am facing weird problem of syncing .I can push easily but unable to pull anything.Also I am not getting any logs of error  in xcode after enabling all log settings.I am using couchbase sync gateway 1.2 at server side.
Also When I rollback my framework to previous version i.e(release/1.2 ) ,syncing started I can both push and pull document smoothly.Can you please guide me how to debug this problem...?

Jens Alfke

unread,
Feb 9, 2016, 1:31:20 PM2/9/16
to mobile-c...@googlegroups.com

On Feb 9, 2016, at 9:57 AM, Raj Shekhar <rajshe...@gmail.com> wrote:

Previously the version I was using was 'release/1.2' from github. Right now I am facing weird problem of syncing .I can push easily but unable to pull anything.Also I am not getting any logs of error  in xcode after enabling all log settings.I am using couchbase sync gateway 1.2 at server side.

This sounds like a regression caused by other changes made in the master branch. Could you file an issue on Github, please?

To get around this, you could create a local branch off of release/1.2, and cherry-pick commit 7bf4593e into it.

—Jens

Raj Shekhar

unread,
Feb 9, 2016, 1:44:32 PM2/9/16
to Couchbase Mobile
Thanks for the quick response.I will file an issue on github soon.I will get back to you in case I got stuck after cherry-pick  commit.

Thanks,
Raj Shekhar
Reply all
Reply to author
Forward
0 new messages