Skip to content

Main thread checks on iOS 15 - unexpected result #788

@lukeredpath

Description

@lukeredpath

Describe the bug
I'm currently doing some smoke testing of our app on iOS 15 using the latest Xcode beta (beta 5) in preparation for the forthcoming final release.

We're using TCA 0.27 and it looks like the recently added main thread checks aren't working as expected, I'm getting output like this:

Warning:

The store was interacted with on a thread that is different from the thread the store was created on:

"ViewStore.send([redacted action])" was called on the wrong thread. Make sure that "ViewStore.send" is always called on the initial thread.

  Initial thread: <NSThread: 0x600000162680>{number = 29, name = main}
  Current thread: <_NSMainThread: 0x6000001b40b0>{number = 1, name = main}

The "Store" class is not thread-safe, and so all interactions with an instance of "Store" (including all of its scopes and derived view stores) must be done on the same thread.
---

Caught debug breakpoint. Type "continue" ("c") to resume execution.

The weird thing here is I know that the first action sent to my store would have been on the main thread because we fire an action in application(_:didFinishLaunching) so I don't know how the initial thread is not the main thread (although strangely it has the name "main").

To Reproduce
If I can put together a reproducer I will uploaded it here.

Expected behavior
When the first action in the app is sent on the main thread, other actions sent from the main thread should not trigger this breakpoint.

Environment

  • TCA 0..27
  • Xcode 13b5
  • iOS 15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions