Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Down] Can't render toAttributedString while app is in background #116

Closed
jonashinge opened this issue Nov 12, 2018 · 4 comments
Closed
Labels
Down Issues specific to the Down renderer workaround-available There is a workaround available

Comments

@jonashinge
Copy link

Report

What did you do?

Used the toAttributedString() method.

What did you expect to happen?

No crash.

What happened instead?

Got the following issue report from Crashlytics:

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x215567ea0 (Missing)
1  libobjc.A.dylib                0x214739a40 (Missing)
2  CoreFoundation                 0x21547dc1c (Missing)
3  Foundation                     0x215fb98f0 (Missing)
4  UIKitCore                      0x24261eb30 (Missing)
5  UIKitCore                      0x24264deb0 (Missing)
6  CoreFoundation                 0x2154f77a8 (Missing)
7  CoreFoundation                 0x2154f243c (Missing)
8  CoreFoundation                 0x2154f21ec (Missing)
9  UIFoundation                   0x21fb6e368 (Missing)
10 UIFoundation                   0x21fb7133c (Missing)
11 UIFoundation                   0x21fbbe3ec (Missing)
12 UIFoundation                   0x21fb71278 (Missing)
13 Down                           0x10691f350 specialized NSAttributedString.init(htmlString:) (NSAttributedString+HTML.swift:36)
14 Down                           0x10691bd24 DownAttributedStringRenderable.toAttributedString(_:stylesheet:) (DownAttributedStringRenderable.swift:44)

In my case the app was launched and while put into background the toAttributedString() was called which caused the exception. When debugging the method was called on the main thread, however enforcing the method to be called on the main thread wrapping it in DispatchQueue.main.async {} seems to fix the issue.
The question is if something similar could be done in the library code itself, only thing is that it will require some callbacks instead of return types as it is now.

This one might help solving the issue: #100

@iwasrobbed iwasrobbed changed the title Crash when using toAttributedString while app is in background [Down] Crash when using toAttributedString while app is in background Nov 13, 2018
@iwasrobbed iwasrobbed added the Down Issues specific to the Down renderer label Nov 13, 2018
@iwasrobbed
Copy link
Collaborator

Thanks @jonashinge , but this is a bit different from the linked issue. Sounds like your workaround will work for now 👍

@iwasrobbed iwasrobbed added the workaround-available There is a workaround available label Dec 20, 2018
@iwasrobbed iwasrobbed changed the title [Down] Crash when using toAttributedString while app is in background [Down] Can't render toAttributedString while app is in background Dec 20, 2018
@iwasrobbed
Copy link
Collaborator

Consolidating this into #100

@iwasrobbed
Copy link
Collaborator

Fixed in #132

@iwasrobbed
Copy link
Collaborator

FYI: this is further possible via the default Styler via #177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Down Issues specific to the Down renderer workaround-available There is a workaround available
Projects
None yet
Development

No branches or pull requests

2 participants