Crash on iOS9 after refetch on sectioned listMonitor #185

Closed
opened 2025-12-29 18:24:09 +01:00 by adam · 7 comments
Owner

Originally created by @zalogatomek on GitHub (Nov 8, 2017).

So, I've added simple sectioned monitor to StackSetupDemoViewController like this:

class StackSetupDemoViewController: UITableViewController, ListObserver {
    
    let monitor = Static.facebookStack.monitorSectionedList(From<UserAccount>(), SectionBy("accountType"), OrderBy(.ascending("name")))

    @IBAction func refetch() {
        monitor.refetch(OrderBy(.ascending("name")))
    }

    typealias ListEntityType = UserAccount

    func listMonitorDidChange(_ monitor: ListMonitor<UserAccount>) {
        print("did change")
    }

    func listMonitorDidRefetch(_ monitor: ListMonitor<UserAccount>) {
        print("did refetch")
    }

I also added a UIBarButtonItem in Storyboard which performs refetch action.

Lastly, in viewWillAppear:

monitor.addObserver(self)

Now, every refetch fails with EXC_BAD_ACCESS:

refetch_fail

I didn't try it on iOS10, but on iOS11 works ok.

Originally created by @zalogatomek on GitHub (Nov 8, 2017). So, I've added simple sectioned monitor to `StackSetupDemoViewController` like this: ```swift class StackSetupDemoViewController: UITableViewController, ListObserver { let monitor = Static.facebookStack.monitorSectionedList(From<UserAccount>(), SectionBy("accountType"), OrderBy(.ascending("name"))) @IBAction func refetch() { monitor.refetch(OrderBy(.ascending("name"))) } typealias ListEntityType = UserAccount func listMonitorDidChange(_ monitor: ListMonitor<UserAccount>) { print("did change") } func listMonitorDidRefetch(_ monitor: ListMonitor<UserAccount>) { print("did refetch") } ``` I also added a `UIBarButtonItem` in Storyboard which performs `refetch` action. Lastly, in `viewWillAppear`: ```swift monitor.addObserver(self) ``` Now, every refetch fails with `EXC_BAD_ACCESS`: ![refetch_fail](https://user-images.githubusercontent.com/19666393/32551733-c6dd21dc-c491-11e7-996f-38d24e7544f5.png) I didn't try it on iOS10, but on iOS11 works ok.
adam added the fixed label 2025-12-29 18:24:09 +01:00
adam closed this issue 2025-12-29 18:24:09 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Nov 9, 2017):

@zalogatomek Does this still happen if you add a monitor.removeObserver(self) from the observer's deinit?

@JohnEstropia commented on GitHub (Nov 9, 2017): @zalogatomek Does this still happen if you add a `monitor.removeObserver(self)` from the observer's `deinit`?
Author
Owner

@zalogatomek commented on GitHub (Nov 9, 2017):

@JohnEstropia Yes, it does.

@zalogatomek commented on GitHub (Nov 9, 2017): @JohnEstropia Yes, it does.
Author
Owner

@JohnEstropia commented on GitHub (Nov 9, 2017):

@zalogatomek Thanks, I'll investigate. Can you tell which CoreStore branch or version you are using?

@JohnEstropia commented on GitHub (Nov 9, 2017): @zalogatomek Thanks, I'll investigate. Can you tell which CoreStore branch or version you are using?
Author
Owner

@zalogatomek commented on GitHub (Nov 9, 2017):

@JohnEstropia I'm on master, 4.2.2. I have also checked prototype/Swift_4_0 in some other project.

In my observation: this does not happen when using CoreStoreObject. In particular List Observer Demo uses CoreStoreObject with sectioned ListMonitor, but it works fine on iOS9.

But I can't (at least at the moment) check CoreStoreObject in mentioned project.

@zalogatomek commented on GitHub (Nov 9, 2017): @JohnEstropia I'm on `master`, `4.2.2`. I have also checked `prototype/Swift_4_0` in some other project. In my observation: this does not happen when using `CoreStoreObject`. In particular List Observer Demo uses `CoreStoreObject` with sectioned `ListMonitor`, but it works fine on iOS9. But I can't (at least at the moment) check `CoreStoreObject` in mentioned project.
Author
Owner

@JohnEstropia commented on GitHub (Nov 9, 2017):

@zalogatomek Fixed this in the latest 4.2.3 version (master). Let me know if it works for you

@JohnEstropia commented on GitHub (Nov 9, 2017): @zalogatomek Fixed this in the latest `4.2.3` version (master). Let me know if it works for you
Author
Owner

@JohnEstropia commented on GitHub (Nov 9, 2017):

For reference, this issue also had been haunting the prototype/Swift_4_0 branch. The commit above was also merged there and I have confirmed that the Swift 4 branch is also fixed now.

@JohnEstropia commented on GitHub (Nov 9, 2017): For reference, this issue also had been haunting the `prototype/Swift_4_0` branch. The commit above was also merged there and I have confirmed that the Swift 4 branch is also fixed now.
Author
Owner

@zalogatomek commented on GitHub (Nov 10, 2017):

@JohnEstropia Works great, thanks

@zalogatomek commented on GitHub (Nov 10, 2017): @JohnEstropia Works great, thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore-JohnEstropia#185