Closed jadar closed 4 days ago
Hey @jadar! Thanx for reporting this.
I'll take a look. From the screenshot, it seems you are assigning a named color from an asset catalog or color set. Could you confirm if there are any specific settings adjusted in the Attribute Inspector? My initial thought is that the color may is not RGB scale (grayscale?) and we may not handle that case correctly.
In the meantime, you might try enabling screenshot mode to bypass this issue temporarily.
Screenshot mode can be enabled with config.sessionReplayConfig.screenshotMode = true
@ioannisj would a simple try/catch here works as a quick win?
@ioannisj would a simple try/catch here works as a quick win?
No, I don't think so since there are no throwing functions involved here.
@ioannisj I think you can do this:
// Ensure the color is in an RGB color space
guard let colorSpace = CGColorSpace(name: CGColorSpace.sRGB),
let rgbColor = self.converted(to: colorSpace, intent: .defaultIntent, options: nil),
let components = rgbColor.components, components.count >= 3 else {
return nil
}
Can you validate if that would help?
Managed to recreate this with the following. I'll see if there is a safe way to convert to sRGB
, otherwise I'll just add the check there
Digging a bit deeper on this one, it seems that the real underlying issue is not the color space (since we were safe with the components.count >= 3 part) but the fact that all named/dynamic colors from the interface builder get their true values set after viewDidLoad. I imagine this is because the view needs to be fully loaded to check the traits before assigning a dark
or light
variant.
Adding the RGB check will only handle the cases where the dynamic color happens to be gray scale (and it's an additional check other that components.count which won't crash), but that's not the ultimate reason for the crash 🤔
Changing the dynamic color to RGB range will again crash the app when components
is accessed.
Printing out layer.borderColor.numberOfComponents prints out some random values like 105553118884896
which is an indication that we are dealing with an uninitialized instance of CGColor from unmanaged code that points to a random memory address
@ioannisj
I'll take a look. From the screenshot, it seems you are assigning a named color from an asset catalog or color set. Could you confirm if there are any specific settings adjusted in the Attribute Inspector?
You're correct that the color comes from an asset catalog. The settings are sRGB with a hexadecimal value of #676767, with 100% opacity. Here's the full contents:
In the meantime, you might try enabling screenshot mode to bypass this issue temporarily. Screenshot mode can be enabled with
config.sessionReplayConfig.screenshotMode = true
I did end up using this workaround as well. I removed references to the custom color in the project, which allowed it to function without crashing. However, the default session capture did not function properly at all, as nothing was distinguishable in the capture.
However, the default session capture did not function properly at all, as nothing was distinguishable in the capture.
Are you referring here to the session recording having some blacked out content. You can try experimenting with maskAllTextInputs
and maskAllImage
to see if this here. docs
A temporary fix on the crash should be out soon btw, I'll let you know once it's out. Hope that helps
@ioannisj
Are you referring here to the session recording having some blacked out content. You can try experimenting with
maskAllTextInputs
andmaskAllImage
to see if this here. docs
It's a little out of the scope of this issue, and I don't know what exactly was the issue, but it appeared all the UI elements were clustered in the top left part of the screen.
Hey @jadar, fyi fix for this bug has been release with 3.14.0
Regarding the session recording issue, can you please open a bug report when you get a chance with some screenshots? I have a feeling you are describing an issue with wireframe mode and not screenshot mode.
Thank you!
Version
3.13.3
Steps to Reproduce
layer.borderColor
in the Storyboard file.Expected Result
No crash
Actual Result