AAkira / Napier

Logging library for Kotlin Multiplatform
Apache License 2.0
831 stars 37 forks source link

Refact DebugAntilog null-safety for ios #97

Closed ColaGom closed 2 years ago

ColaGom commented 2 years ago

Environment

Snippets

common module

fun initKoin() { ... Napier.d("initialized koin") }

AppDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ...
    NapierProxyKt.debugBuild()
    ...
    KoinKt.initKoin()

Print Symbols

0 null
1 null
2 null
3 null
4 null
5 null
6 null
7 null
8 null <<- is null
9 null
10 null
11 null
12  UIKitCore                           0x00000001227f5f2f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 216
13  UIKitCore                           0x00000001227f7b9f -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4115
14  UIKitCore                           0x00000001227fd50e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1221
15  UIKitCore                           0x0000000121d79c7a -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
16  UIKitCore                           0x00000001223661c6 _UIScenePerformActionsWithLifecycleActionMask + 88
17  UIKitCore                           0x0000000121d7a771 __101-[_UISceneLifecycleMultiplexer

Desc

Solution

AAkira commented 2 years ago

Thank you! I know it is difficult. But I'd be glad to know how to reproduce it if possible.

ColaGom commented 2 years ago

@AAkira thks for review 😄

More detail about reproduce step as below

Environment

Apple M1 + xcode with rosetta, Monterey 12.3 Apple intel + xcode, Monterey 12.3 iOS 15.2 iPhone 11 simulator

Reproduce step

  1. First run ios-app in xcode is no issue.
  2. Re-run app occurs NPE after fixing some code(swift)
    • If delete app and run it, issue does not occur.
AAkira commented 2 years ago

Thank you!

I don't have an M1 Mac right now, I will try it when I get it!