SVProgressHUD: problem of using in xcode10.2

when I debug in xcode,SVProgressHUD first call in my project,it will pause UI and Data handle for a while。I don’t know Whether or not because the xcode version,It won’t be like this until it’s updated.

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 4231, TID: 1211204, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001b2c93534 <redacted> + 56
5   CoreMotion                          0x00000001b951c040 CoreMotion + 307264
6   CoreMotion                          0x00000001b951c574 CoreMotion + 308596
7   CoreMotion                          0x00000001b951c484 CoreMotion + 308356
8   CoreMotion                          0x00000001b954dc64 CoreMotion + 511076
9   CoreMotion                          0x00000001b954dcc4 CoreMotion + 511172
10  CoreFoundation                      0x00000001b3a2c354 <redacted> + 28
11  CoreFoundation                      0x00000001b3a2bc38 <redacted> + 276
12  CoreFoundation                      0x00000001b3a26f14 <redacted> + 2324
13  CoreFoundation                      0x00000001b3a262e8 CFRunLoopRunSpecific + 452
14  CoreFoundation                      0x00000001b3a2704c CFRunLoopRun + 84
15  CoreMotion                          0x00000001b954d5fc CoreMotion + 509436
16  libsystem_pthread.dylib             0x00000001b36a0974 <redacted> + 132
17  libsystem_pthread.dylib             0x00000001b36a08d0 _pthread_start + 52
18  libsystem_pthread.dylib             0x00000001b36a8ddc thread_start + 4
2019-03-30 16:46:06.431304+0800 DLMSDKDemo[4231:1211204] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 4231, TID: 1211204, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001b2c93534 <redacted> + 56
5   CoreMotion                          0x00000001b951c040 CoreMotion + 307264
6   CoreMotion                          0x00000001b951c574 CoreMotion + 308596
7   CoreMotion                          0x00000001b951c484 CoreMotion + 308356
8   CoreMotion                          0x00000001b954dc64 CoreMotion + 511076
9   CoreMotion                          0x00000001b954dcc4 CoreMotion + 511172
10  CoreFoundation                      0x00000001b3a2c354 <redacted> + 28
11  CoreFoundation                      0x00000001b3a2bc38 <redacted> + 276
12  CoreFoundation                      0x00000001b3a26f14 <redacted> + 2324
13  CoreFoundation                      0x00000001b3a262e8 CFRunLoopRunSpecific + 452
14  CoreFoundation                      0x00000001b3a2704c CFRunLoopRun + 84
15  CoreMotion                          0x00000001b954d5fc CoreMotion + 509436
16  libsystem_pthread.dylib             0x00000001b36a0974 <redacted> + 132
17  libsystem_pthread.dylib             0x00000001b36a08d0 _pthread_start + 52
18  libsystem_pthread.dylib             0x00000001b36a8ddc thread_start + 4

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 15
  • Comments: 23

Most upvoted comments

@honkmaster Since this issue is annoying many people, could you please make a new release containing this workaround? I know that I can specify commits or branches in my Podfile, but I don’t want to. ^^

this also helped me, yeah it doesn’t happen in production and on the simulator, just a device in debug, just must be a xcode hang. ill submit a bug report, but honestly i think the code is fine, just the Main thread ui checker being meh.

You can also turn off the main ui checker under product->scheme->edit scheme->diagnostics, uncheck main thread checker, if you want to

AFAIK, This only happens on very first show and SVProgressHUD is not the one that’s causing the problem. The problem is caused by CMMotion is warming up the senors, maybe?!

At this point even, CMMotionManager().startDeviceMotionUpdates() will cause the same error. It seems UI Thread checker is too good and catching things we can’t do anything about but file a bug.

A good compromise is to wrap nonsensicals in pre-processing macro.

    #if DEBUG
        SVProgressHUD.show()
        SVProgressHUD.dismiss()
    #endif

Warm up CoreMotion way before you need it. It doesn’t seem to have a problem during production.

Just edit scheme to close the main checker. It works for me.

@hackerpex that is essentially the same as what I did here pod 'SVProgressHUD', :git => 'https://github.com/mmdock/SVProgressHUD.git', :branch => 'patch-1'

However, instead of just outright removing it, the ability to disable it from being called in the first place but keeping it would be the better approach as seen in this pr: https://github.com/SVProgressHUD/SVProgressHUD/pull/952