0

How to resolve this issue

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.

I know this means some UIKit code is called from a background thread, and I know the solution is to wrap the code in

dispatch_async(dispatch_get_main_queue(), ^(void){ <code> });

My problem is locating where to do that and How can I identify the background code which is apparently modifying the UI?

Any help is welcome..

Thanks!

PrasathBabu
  • 4,716
  • 4
  • 19
  • 35
  • Have you checked if you have not called some UIKit methods those may cause update constraints (like `updateConstraintsIfNeeded`, `setNeedsUpdateConstraints`, etc.) in background thread? If possible, share code snippet. – Sunil Chauhan Feb 03 '16 at 06:13

1 Answers1

0

This code PSPDFUIKitMainThreadGuard causes assertions on UIKit access outside the main thread

Steps to use:

1.Add to project and compile this file without ARC

2.Move PSPDFAssert definition to the first of the file

3.Comment calling of PSPDFLogError as it is not defined

4.import

Your app will crash and stop with any attemption to modify any UI element from background thread see this Link

Community
  • 1
  • 1
viratpuar
  • 524
  • 1
  • 5
  • 22