Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]

后端 未结 6 2009
故里飘歌
故里飘歌 2020-12-01 00:28

I am using google maps in Xcode 9 beta, iOS 11.

I am getting an error outputted to the log as follows:

Main Thread Checker: UI API called on a

6条回答
  •  一整个雨季
    2020-12-01 01:14

    First, make sure your invocations of google maps and ui changes are called from the main thread.

    You can enable the Thread Sanitizer to find offending lines.

    You can put offending lines on the main thread with the following:

    DispatchQueue.main.async {
        //Do UI Code here. 
        //Call Google maps methods.
    }
    

    Also, update your current version of google maps. Google maps had to make a couple of updates for the thread checker.

    For the question: "Why would this be occurring?" I think Apple added an assertion for an edge case which Google then had to update their pod for.

提交回复
热议问题