Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log show HUD not run in main thread #245

Open
whlsxl opened this issue Jan 14, 2019 · 17 comments
Open

Log show HUD not run in main thread #245

whlsxl opened this issue Jan 14, 2019 · 17 comments

Comments

@whlsxl
Copy link

whlsxl commented Jan 14, 2019

I test PKHUD in viewDidAppear

HUD.show(.labeledProgress(title: nil, subtitle: "loading..."))

still got Thread Error, but I'm sure HUD run in main thread!

opened :Main thread checker
Xcode :Version 10.1 (10B61)
iOS :12.1.1
Device :iPad 11"

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 841, TID: 208513, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001c487f894 <redacted> + 56
5   CoreMotion                          0x00000001cb105040 CoreMotion + 307264
6   CoreMotion                          0x00000001cb105574 CoreMotion + 308596
7   CoreMotion                          0x00000001cb105484 CoreMotion + 308356
8   CoreMotion                          0x00000001cb136c64 CoreMotion + 511076
9   CoreMotion                          0x00000001cb136cc4 CoreMotion + 511172
10  CoreFoundation                      0x00000001c56164fc <redacted> + 28
11  CoreFoundation                      0x00000001c5615de0 <redacted> + 276
12  CoreFoundation                      0x00000001c56110e4 <redacted> + 2324
13  CoreFoundation                      0x00000001c56104b8 CFRunLoopRunSpecific + 452
14  CoreFoundation                      0x00000001c561121c CFRunLoopRun + 84
15  CoreMotion                          0x00000001cb1365fc CoreMotion + 509436
16  libsystem_pthread.dylib             0x00000001c528b974 <redacted> + 132
17  libsystem_pthread.dylib             0x00000001c528b8d0 _pthread_start + 52
18  libsystem_pthread.dylib             0x00000001c5293ddc thread_start + 4
2019-01-15 00:24:32.721938+0800 MagicController[841:208513] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 841, TID: 208513, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   libobjc.A.dylib                     0x00000001c487f894 <redacted> + 56
5   CoreMotion                          0x00000001cb105040 CoreMotion + 307264
6   CoreMotion                          0x00000001cb105574 CoreMotion + 308596
7   CoreMotion                          0x00000001cb105484 CoreMotion + 308356
8   CoreMotion                          0x00000001cb136c64 CoreMotion + 511076
9   CoreMotion                          0x00000001cb136cc4 CoreMotion + 511172
10  CoreFoundation                      0x00000001c56164fc <redacted> + 28
11  CoreFoundation                      0x00000001c5615de0 <redacted> + 276
12  CoreFoundation                      0x00000001c56110e4 <redacted> + 2324
13  CoreFoundation                      0x00000001c56104b8 CFRunLoopRunSpecific + 452
14  CoreFoundation                      0x00000001c561121c CFRunLoopRun + 84
15  CoreMotion                          0x00000001cb1365fc CoreMotion + 509436
16  libsystem_pthread.dylib             0x00000001c528b974 <redacted> + 132
17  libsystem_pthread.dylib             0x00000001c528b8d0 _pthread_start + 52
18  libsystem_pthread.dylib             0x00000001c5293ddc thread_start + 4
2019-01-15 00:24:32.925872+0800 MagicController[841:208454] [framework] CUIThemeStore: No theme registered with id=0
@whlsxl
Copy link
Author

whlsxl commented Jan 14, 2019

simulator is OK, device show this warning, find someone have same issue on iPhone Xs iPhone X

@stefanrenne
Copy link
Contributor

Seems to be Apple iOS 12 weirdness, see this open radar ticket http://www.openradar.me/45003816

@whlsxl
Copy link
Author

whlsxl commented Jan 31, 2019

Thanks @stefanrenne
That's true, but run the code above, the warning must show, maybe some API from apple, trigger this warning.

@evandorn
Copy link

evandorn commented Feb 1, 2019

Same issue on iPhone XR

@jbmaxwell
Copy link

Same issue, iPhone XR, iOS 12.1.4, presenting from main thread, async.

@vlainvaldez
Copy link

vlainvaldez commented Mar 19, 2019

same issue happening to me, any updates?

iPhone XS: iOS 12.1.4

@evandorn
Copy link

evandorn commented Apr 1, 2019

Running Xcode 10.2 with Swift 5. This warning is now causing main thread freezes.

@Malibris
Copy link

Malibris commented Apr 4, 2019

Same issue, weirdly the freeze happens only after the HUD is being shown for the first time per the app's instance. Next calls, and calls made after a restart are not blocking.

@jaymathew
Copy link

Same here Xcode 10.2, Swift 5, IPhone XS, only happens on first show. Any workaround or fix ?

@tandinhlee
Copy link
Contributor

Checked: Only happened when debugging. Run without debugger or run release is fine (Not cause freezes main thread)

@sushant-here
Copy link

Does anyone know if there is a temporary workaround for this?

@stefanrenne
Copy link
Contributor

stefanrenne commented May 13, 2019

I just found a solution / workaround for this, see my PR #252

@deepak4u2006
Copy link

I just found a solution / workaround for this, see my PR #252
Is this merged to master ?

@tomokisun
Copy link

PKHUD : Version 5.3.0
Xcode :Version 10.2.1 (10E1001)
iOS : 12.2
Device : iPhoneXs

It has not been cured yet

@leshque
Copy link

leshque commented Jun 18, 2019

@tomoki69386 same
PKHUD: 5.3.0
Xcode: Version 10.2.1 (10E1001)
iOS 12.3.1
Device iPhone XS

Still reproduces and looks like it happens only on first show() call.

@jackydhc
Copy link

same issue in iphone xr iphone xs and just occured in first call

@NickAger
Copy link

A temporary fix is to remove/comment-out UIInterpolatingMotionEffect from FrameView.commonInit as:

    private func commonInit() {
        backgroundColor = UIColor(white: 0.8, alpha: 0.36)
        layer.cornerRadius = 9.0
        layer.masksToBounds = true

        contentView.addSubview(content)

//        let offset = 20.0
//
//        let motionEffectsX = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis)
//        motionEffectsX.maximumRelativeValue = offset
//        motionEffectsX.minimumRelativeValue = -offset
//
//        let motionEffectsY = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis)
//        motionEffectsY.maximumRelativeValue = offset
//        motionEffectsY.minimumRelativeValue = -offset
//
//        let group = UIMotionEffectGroup()
//        group.motionEffects = [motionEffectsX, motionEffectsY]
//
//        addMotionEffect(group)
    }

NickAgerMoletest pushed a commit to Moletest-Scotland/PKHUD that referenced this issue Sep 18, 2019
* see pkluz#245 (with my comment)
* see pkluz#251 - which documents an attempted fix in pull request pkluz/PKHUD/pkluz#252
* see another attempt which just conditionally enables the code - pkluz/PKHUD/pkluz#260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests