I’m experiencing something odd with -scrollViewDidScroll:
In every call I obtain the last object from an NSMutableArray, and add another object to that NSMutableArray.
But it seems the NSMutableArray does not store the object in time before the next call and when I try to get the last inserted object, it is not the last one I inserted. There is something async happening.
Is this a known issue? How can I see if it is called in the Main Thread?
It’s called on the main thread. You can check by adding a breakpoint in Xcode in
-scrollViewDidScroll:, and looking at the call stack.Alternatively NSThread has some pretty useful methods here, such as +isMainThread, or +callStackSymbols.
NSThread Docs