Re: How to update UI from a background thread

2016-09-23 Thread Uli Kusterer
On 21 Sep 2016, at 18:20, Dave 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

Re: How to update UI from a background thread

2016-09-22 Thread Shane Stanley
On 22 Sep. 2016, at 10:20 pm, Dave wrote: > > myNetworkleScriptSourceString = [[NSString alloc] > initWithContentsOfFile:myNetworkleScriptFilePath > encoding:NSUTF8StringEncoding error:&myErrorInfo]; > if (myErrorInfo != nil) You should be testing for !myNetworkleScriptSourceString; you should

Re: How to update UI from a background thread

2016-09-22 Thread Shane Stanley
On 23 Sep. 2016, at 1:42 am, Jens Alfke wrote: > > AFAIK, AppleScripts can only be run on the main thread. But it’s been many OS > releases since I worked with them. FYI, that hasn't been the case for quite some time. -- Shane Stanley , ___ Co

Re: How to update UI from a background thread

2016-09-22 Thread Gary L. Wade
If it's possible, I would ask the tool developer to provide you with a command line or XPC version and try accessing these state transitions in a more UI-thread-friendly manner. Have you stopped your debugger when the freeze happens to see what your main thread stack frame looks like? It might

Re: How to update UI from a background thread

2016-09-22 Thread Dave
Ok, will do thanks a lot. The AppleScript is/should be on the Main Thread. I am assuming that the App the Script has finished when it returns but maybe that is not the case. I will look into that too. Thanks a lot for your help. Cheers Dave > On 22 Sep 2016, at 16:42, Jens Alfke wrote: > >

Re: How to update UI from a background thread

2016-09-22 Thread Jens Alfke
> On Sep 22, 2016, at 5:20 AM, Dave wrote: > > So I’m wondering if it is something to do with the AppleScript handling? AFAIK, AppleScripts can only be run on the main thread. But it’s been many OS releases since I worked with them. Even if it’s legal to run them from a background thread now

Re: How to update UI from a background thread

2016-09-22 Thread Dave
Hi Jens, There is definitely something fishy going on, I’ll explain the process and how I am handling it. There is probably a much better way of doing it and if so I’m happy to redesign it. In order to kick off a Network an third part App needs to be run which starts up a process that “looks”

Re: How to update UI from a background thread

2016-09-21 Thread Jens Alfke
> On Sep 21, 2016, at 10:13 AM, Doug Hill wrote: > > The symptoms you mention sound like a classic deadlock problem. That is, a > code block running on the main queue schedules another code block on the main > queue, but the original block never completes thus causing the app to hang or > the

Re: How to update UI from a background thread

2016-09-21 Thread David Hoerl
> How can I update my UI from a background thread? > > I have a method that does a LOT of intense processing, it calls a delegate method in my Window Controller which appends it to a Logging Scroll View, however nothing shows up in the Scroll View although it NSLog’s the string ok. --- There

Re: How to update UI from a background thread

2016-09-21 Thread Doug Hill
> On Sep 21, 2016, at 10:00 AM, Quincey Morris > wrote: > > On Sep 21, 2016, at 09:20 , Dave wrote: >> >> The time consuming method I am calling is in a third party library and it >> must be called in the main thread. > > You cannot update UI on a background thread, so if the library metho

Re: How to update UI from a background thread

2016-09-21 Thread Jens Alfke
> On Sep 21, 2016, at 8:40 AM, Dave wrote: > > How can I update my UI from a background thread? You can’t literally do that. But you can schedule code to run on the main thread, and update the UI in that code. Use dispatch_async to schedule the UI-related code on the main thread/queue. Or if

Re: How to update UI from a background thread

2016-09-21 Thread Quincey Morris
On Sep 21, 2016, at 09:20 , Dave wrote: > > The time consuming method I am calling is in a third party library and it > must be called in the main thread. You cannot update UI on a background thread, so if the library method is blocking the main thread you’re out of luck. The only solution is

Re: How to update UI from a background thread

2016-09-21 Thread Dave
Hi, 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 f

Re: How to update UI from a background thread

2016-09-21 Thread Sandor Szatmari
In general, one simple form is: dispatch_async( dispatch_get_main_queue(), ^{ // do UI updates on the main thread. }); This can also be done with NSOperationQueue: [[NSOperationQueue mainQueue] addOperationWithBlock:^{ // do UI updates on main thread. }]; Sandor Szatmari > On Sep 21, 2016, at

How to update UI from a background thread

2016-09-21 Thread Dave
Hi All, How can I update my UI from a background thread? I have a method that does a LOT of intense processing, it calls a delegate method in my Window Controller which appends it to a Logging Scroll View, however nothing shows up in the Scroll View although it NSLog’s the string ok. Firstly i