Skip to content

Main Thread Checker: UI API called on a background thread: -[UIView init] #69

Closed
@Jeehut

Description

@Jeehut

Describe the bug
Calling Analytics.init() crashes my app with the following error:

Main Thread Checker: UI API called on a background thread: -[UIView init]

The line causing the crash is this in AppleUtils.swifts userAgent computed property:

return WKWebView().value(forKey: "userAgent") as? String

To Reproduce
Steps to reproduce the behavior:

  1. Call the initializer of Analytics from a background thread (e.g. utility)

Expected behavior
Analytics is a task that I expect to work in the background.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Library Version in use: 1.0.3
  • Platform being tested: iOS 15
  • Integrations in use: N/A

Additional context
N/A

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions