I getting an error that Iam changing the autolayout engine from a background thread , is there's a way to know which block of code makes this warning ? or I just have to search for it by myself ?? Thank you.
Asked
Active
Viewed 966 times
0
-
you can set breakpoints in xCode like this, and maybe it will show you the block of code makes your warning. [enter image description here](http://i.stack.imgur.com/YLZVN.png) – Ildar.Z Apr 10 '16 at 12:45
-
if you're updating the constraints in your code just put them under NSOperationQueue mainQueue block. – Bhavuk Jain May 14 '16 at 12:24
1 Answers
0
Probably there is a better answer but I would start by putting
for Swift:
assert(NSThread.isMainThread(), "Expected code to be called on main thread");
for Objective-C:
NSAssert([NSThread isMainThread], @"Expected code to be called on main thread");
to all sections of your code you're suspicious about.
This way app will crash if you're doing that code not on main thread.
Is this error an error or is it an exception? If it is exception you can try to catch it using exception breakpoint like here: How to debug “Collection was mutated while being enumerated” errors and like, when Xcode does not provide me with enough information? ?
After having looked at your exact message looks like what you need is:
This code PSPDFUIKitMainThreadGuard causes assertions on UIKit access outside the main thread
taken from iOS9 - This application is modifying the autolayout engine from a background thread — where?.

Community
- 1
- 1

Stanislav Pankevich
- 11,044
- 8
- 69
- 129
-
I have a project with almost 30K lines of code :D , I cant do this – user3703910 Apr 10 '16 at 12:42
-
Is this error an error or is it an exception? If it is exception did you try to catch it using exception breakpoint like [here](http://stackoverflow.com/a/16072549/598057) ? – Stanislav Pankevich Apr 10 '16 at 12:44
-
it's a warning , the system prints on the xcode's console this : 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 – user3703910 Apr 10 '16 at 12:54
-
See [iOS9 - This application is modifying the autolayout engine from a background thread — where?](http://stackoverflow.com/a/32680772/598057). – Stanislav Pankevich Apr 10 '16 at 12:56