“从后台线程修改autolayout引擎”

时间:2016-05-31 18:19:04

标签: ios multithreading

我已经能够调用后台线程来加速我的应用程序。然而,Xcode向我发出警告“此应用程序正在从后台线程修改自动布局引擎,这可能导致引擎损坏和奇怪的崩溃。这将导致未来版本中的异常。”发生了什么事?

enter image description here

let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
        dispatch_async(dispatch_get_global_queue(priority, 0)) {

            //one of these methods is running autolayout in background thread.
            self.hashtagTableAdapter = HashtagTableAdapter(hashtagTableView: hashtagTableView, baseSearchTableSelectItemDelegate: self, hashtagUserDataProviderDelegate: self)
            self.userTableAdapter = UserTableAdapter(userTableView: userTableView, baseSearchTableSelectItemDelegate: self, hashtagUserDataProviderDelegate: self)
            self.phoneBookTableAdapter = PhoneBookTableAdapter(phoneBookTableView: self.phoneTableView, baseSearchTableSelectItemDelegate: self, showInvitedUsers: true)
            self.allTableAdapter = AllTableAdapter(allTableView: allTableView, hashtagUserDataSource: self.userTableAdapter.userTableDataSource, phoneBookDataSource: self.phoneBookTableAdapter.phoneBookDataSource, hashtagUserDataProviderDelegate: self, baseSearchTableSelectItemDelegate: self)

            dispatch_async(dispatch_get_main_queue()) {
                self.tableAdapters.append(self.allTableAdapter)
                self.tableAdapters.append(self.hashtagTableAdapter)
                self.tableAdapters.append(self.userTableAdapter)
                self.tableAdapters.append(self.phoneBookTableAdapter)
                self.reloadRecentSearchSectionInAllTab()
                self.queryTF.becomeFirstResponder()
            }
        }

0 个答案:

没有答案