skip to Main Content

I am having crashes in my app – but I don’t even know how to get to debug this issue.

Background

I tried changing couple of things blindly to see if at least the stacktrace changes, but at least crashlytics is reporting pretty much the same issue for all users. (OUTLINED_FUNCTION_5).
I also use FirebaseFirestore and ViewModels approach (StateObjects) across the entire app.

Issue

How can I figure out what is this outlined function? Can I somehow get to the actual name of it or where in the code it is?

Stacktrace

0 SwiftUI OUTLINED_FUNCTION_5 + 84044
1 SwiftUI OUTLINED_FUNCTION_5 + 70408
2 SwiftUI OUTLINED_FUNCTION_242 + 6312
3 SwiftUI OUTLINED_FUNCTION_15 + 868
4 SwiftUI OUTLINED_FUNCTION_28 + 480
5 SwiftUI OUTLINED_FUNCTION_52 + 1356
6 SwiftUI OUTLINED_FUNCTION_52 + 1500
7 UIKitCore _UIUpdateSequenceRun + 84
8 UIKitCore schedulerStepScheduledMainSection + 172
9 UIKitCore runloopSourceCallback + 92
10 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
11 CoreFoundation __CFRunLoopDoSource0 + 176
12 CoreFoundation __CFRunLoopDoSources0 + 244
13 CoreFoundation __CFRunLoopRun + 836
14 CoreFoundation CFRunLoopRunSpecific + 612
15 GraphicsServices GSEventRunModal + 164
16 UIKitCore -[UIApplication _run] + 888
17 UIKitCore UIApplicationMain + 340
18 SwiftUI OUTLINED_FUNCTION_895 + 2424
19 SwiftUI block_copy_helper.1 + 388
20 SwiftUI OUTLINED_FUNCTION_901 + 2820
21 Pet parents <compiler-generated> - Line 4332488680 main + 4332488680
22 (Missing)

Any helps is appreciated, thanks!

2

Answers


  1. I have a similar crash in runtime. In my case, I find a way to reproduce: use Swift 5.8 and set SWIFT_OPTIMIZATION_LEVEL to Optimize for Speed: [-O] for Debug builds

    In these conditions, I have a crash if I run the code:

    let circle = Circle().frame(width: 8, height: 8)
    let arrow = Image(systemName: "arrow.up")
    HStack {
        circle
        arrow
    }
    HStack {
        arrow
    }
    

    but if you replace let circle with lazy var circle, it fixes all!

    lazy var circle = Circle().frame(width: 8, height: 8) // fix
    let arrow = Image(systemName: "arrow.up")
    HStack {
        circle
        arrow
    }
    HStack {
        arrow
    }
    

    Update

    Make issue https://github.com/apple/swift/issues/65059 for Swift developers

    Login or Signup to reply.
  2. I had a similar issue in my app. I was asking for a video size from AVFoundation API’s so I could calculate an aspect ratio for a view. I was applying the aspect ratio like so:

    .aspectRatio(aspectRatio, contentMode: .fit)
    

    The problem was that sometimes AVFoundation would return a ‘NaN’ which would then cause the stack trace full of OUTLINED_FUNCTION.

    Are you doing something in your codebase?

    Unfortunately it looks like OUTLINED_FUNCTION is some internal swiftUI stuff. In regards to debugging tips. I managed to diagnose my issue by:
    enter image description here

    Using the arrows on the right here to scroll through the different instances of the crash and trying to see what they having in common in stack trace, and also on this logs tab. This "Logs" tab I have open here gives a series of breadcrumbs the user went through leading up to the crash. If you expand the event you can also get a bit more information. After analysing enough logs in this way I managed to extract the common points and replicate the issue after combining this with some code review. I hope this helps you/someone else or at least gives you some ideas! I could not find much information on OUTLINED_FUNCTION!!!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search