burczyk / UIForLumberjack

iOS UI library to display CocoaLumberjack logs on iOS device

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seems like an issue on iOS10, if logger is registered before "didFinishLaunchingWithOptions"

NikolayEntin opened this issue · comments

Hi,

There is a [widely discussed] problem with iOS10, when apps are crashing on attempt to scroll an UITableView with the error

*** Assertion failure in -[UIGestureGraphEdge initWithLabel:sourceNode:targetNode:directed:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.6.21/Source/GestureGraph/UIGestureGraphEdge.m:25 Invalid parameter not satisfying: targetNode (
0 CoreFoundation 0x00000001127d0d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011000421e objc_exception_throw + 48
2 CoreFoundation 0x00000001127d4e42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000111e7e66d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 UIKit 0x0000000111128c71 -[UIGestureGraphEdge initWithLabel:sourceNode:targetNode:directed:] + 445
5 UIKit 0x00000001109ab777 -[UIGestureGraph addUniqueEdgeWithLabel:sourceNode:targetNode:directed:properties:] + 711
6 UIKit 0x0000000110a8c0ed -[UIGestureEnvironment _addDynamicRequirementForGestureRecognizer:requiringGestureRecognizerToFail:] + 159
7 UIKit 0x0000000110a925a7 _UIGestureRecognizerQueryDynamicFailureRequirements + 1415
8 UIKit 0x0000000110a8ea59 _UIGestureEnvironmentUpdate + 78
9 UIKit 0x0000000110a8e9c3 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 521
10 UIKit 0x0000000110a8dba6 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 286
11 UIKit 0x00000001105d3c1d -[UIWindow sendEvent:] + 3989
12 UIKit 0x00000001105809ab -[UIApplication sendEvent:] + 371
13 UIKit 0x0000000110d6d72d __dispatchPreprocessedEventFromEventQueue + 3248
14 UIKit 0x0000000110d66463 __handleEventQueue + 4879
15 CoreFoundation 0x0000000112775761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
16 CoreFoundation 0x000000011275a98c __CFRunLoopDoSources0 + 556
17 CoreFoundation 0x0000000112759e76 __CFRunLoopRun + 918
18 CoreFoundation 0x0000000112759884 CFRunLoopRunSpecific + 420
19 GraphicsServices 0x00000001149c0a6f GSEventRunModal + 161
20 UIKit 0x0000000110562c68 UIApplicationMain + 159
21 Link'em 0x000000010f10ee2d main + 2653
22 libdyld.dylib 0x000000011349c68d start + 1
23 ??? 0x0000000000000001 0x0 + 1

I think it's properly reflected in the last message on this thread: https://forums.developer.apple.com/thread/61432, i.e. "suspect this is due to the UIGestureRecognizer's global enviroment is not set up yet".

In my case logging starts yet before Application finished launching (I need to log information yet during app start-up, and initialising important services).
If I move the
[DDLog addLogger:[UIForLumberjack sharedInstance]];
from main to didFinishLaunchingWithOptions, there are no crashes anymore, but some start-up-logged messages are missing.
All worked well in iOS8-9, but not in 10.
I'd recommend to split initialisation of the message logging and initialisation of view (e.g. to the first call of "showInView".
What do you think?

Can you please provide a Pull Request with proposed changes?