Open macdrevx opened 3 months ago
I shared this issue on the Apple Dev Forums: https://developer.apple.com/forums/thread/762078
The recommendation is that we should update this to avoid using UIKit prior to main
, which implies not using it in +load
.
Here's my fix: https://github.com/happybits/STULabel/blob/eded97a3db8e4b104848aebe33c8e9121ab174d1/STULabel/STUMainScreenProperties.m#L60 I lazy-load on first access of the exported stu_mainScreen…()
functions, with a main thread check to avoid deadlock.
If that solution looks appealing then I'd happily open a PR, just let me know.
sounds promising. could you go ahead and open the PR so we can see the diff more easily?
@macdrevx done!
@macdrevx Thank you for reporting this issue!
Did you already get any reply from Apple on the feedback issue, other than the forum reply?
Are you aware of any documentation implying that UIKit methods can't be called prior to main?
@stephan-tolksdorf the reply on the forums is the only one I received. I'm not aware of any statement in the docs about using UIKit prior to main.
@stephan-tolksdorf looks like you received a reply from Apple on the forums post: https://developer.apple.com/forums//thread/762078?answerId=802399022#802399022
Also filed with Apple as FB14703057 (Deadlock in UIKit while injecting test bundle).
Steps to repro:
Actual behavior:
Tests fail to launch due to deadlock
Expected behavior:
Tests run
--
Deadlock occurs inside of the
UIScreen.mainScreen
access initiated by+load
added in the category on UIScreen.