Simultaneous accesses to 0x1c0a7f0f8, but modification requires exclusive access error on Xcode 9 beta 4

后端 未结 11 1838
孤城傲影
孤城傲影 2020-11-29 05:15

my project uses both Objective-C and Swift code. When a user logs in, it calls a set of apis for user preference, I have a DataCoordinator.swift class which schedules the AP

11条回答
  •  情话喂你
    2020-11-29 05:38

    This was happening for me when, when I was modifying the predicate as per search query and also reloading the table so its sort of reentry (access) to the same class object code. Please check my stack trace, its setting the 'searchPhrase' and from DB worker again triggering the table reload which in-turn comes back to DB worker again (for Item count. after reloadData).

    0    libswiftCore.dylib                 0x000000010a325590 swift_beginAccess + 568
    1    Groupe                             0x00000001063d5cf0 SCPickUsersInteractor.dbWorker.getter + 59
    2    Groupe                             0x00000001063d5830 SCPickUsersInteractor.count.getter + 58
    3    Groupe                             0x00000001063d8550 protocol witness for SCPickUsersInteractorProtocol.count.getter in conformance SCPickUsersInteractor + 14
    4    Groupe                             0x0000000105a340d0 SCPickUsersViewController.tableView(_:numberOfRowsInSection:) + 278
    5    Groupe                             0x0000000105a34280 @objc SCPickUsersViewController.tableView(_:numberOfRowsInSection:) + 76
    6    UIKitCore                          0x00007fff482a3537 -[UITableView _numberOfRowsInSection:] + 62
    7    UIKitCore                          0x00007fff482b3c42 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1938
    8    UIKitCore                          0x00007fff482b85cd -[UITableViewRowData numberOfRows] + 67
    9    UIKitCore                          0x00007fff4827362d -[UITableView noteNumberOfRowsChanged] + 117
    10   UIKitCore                          0x00007fff48271b8b -[UITableView reloadData] + 1426
    11   Groupe                             0x0000000105a35890 SCPickUsersViewController.reloadTableView() + 152
    12   Groupe                             0x0000000105a37060 protocol witness for SCListUpdatesProtocol.reloadTableView() in conformance SCPickUsersViewController + 9
    13   Groupe                             0x00000001068a14f0 SCPickUsersPresenter.reloadTableView() + 158
    14   Groupe                             0x00000001068a2350 protocol witness for SCListUpdatesProtocol.reloadTableView() in conformance SCPickUsersPresenter + 17
    15   Groupe                             0x0000000105a8bc90 SCPickUsersDBWorker.searchPhrase.didset + 911
    16   Groupe                             0x0000000105a8c0e0 SCPickUsersDBWorker.searchPhrase.setter + 356
    17   Groupe                             0x0000000105a8ffb0 protocol witness for SCFRCProtocol.searchPhrase.setter in conformance SCPickUsersDBWorker + 37
    18   Groupe                             0x00000001063d6500 SCPickUsersInteractor.searchPhrase.setter + 274
    19   Groupe                             0x00000001063d8630 protocol witness for SCPickUsersInteractorProtocol.searchPhrase.setter in conformance SCPickUsersInteractor + 17
    20   Groupe                             0x0000000105a34eb0 SCPickUsersViewController.searchBar(_:textDidChange:) + 322
    21   Groupe                             0x0000000105a35020 @objc SCPickUsersViewController.searchBar(_:textDidChange:) + 105
    

    Solution worked for me: Called 'reloadData' from DB worker class after few milli seconds or half a second.

提交回复
热议问题