On 21 Sep 2016, at 18:20, Dave <d...@looktowindward.com> wrote:
> This doesn’t work probably because the Class is that is calling back the 
> delegate method that updates the Scroll View is also being run on the main 
> thread. Sorry I should have said this earlier. I tried updating the UI on a 
> background thread and it seemed to work BUT I got warning message from 
> CALayer or maybe CATransaction and I think it caused the App to hang.

 You can do limited drawing into an existing view hierarchy on a secondary 
thread (that's how e.g. the throbbing default button in previous OS versions 
was drawn), but you have to do it in a very particular way.

Whatever you do, you mustn't manipulate the view hierarchy from a thread. All 
that'll do is screw up AppKit's or UIKit's internal data structures and lead to 
random crashes due to memory corruption.

> The time consuming method I am calling is in a third party library and it 
> must be called in the main thread. 

 Does it need to be running in your application? Usually you do most of the 
work on a secondary thread, then use dispatch_async() or so to send the parts 
that need to happen on the main thread back there. If you can't do that, 
another option would be to run the code on the main thread of another process, 
e.g. using XPC, and have that call you back when it needs to make your app do 
something on *its* main thread.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to