Requests originating on background thread

I have some code running on a timer that comes in on a background thread from GCD - it seems when I call any method on the data service (didn’t try custom API endpoint) the request never goes out and just silently fails with no indication of a problem (or success).

Does this imply that all call to your services must come from the main thread? I don’t recall seeing this documented nor is it very ideal for maintaining responsiveness of the UI on the main thread.

Our Synchronous APIs are not aware of the thread you use to invoke them. If you use the async APIs, we allocate a new thread internally. Which kind do you use?

Async

Could it be a policy restriction in GCD which would not allow the code to allocate a new thread? Have you tried the sync api to see if it makes a difference? There is nothing in our code that should be dependent on the surrounding environment.

I don’t believe any such restriction exists. (re: new Threads - this isn’t a managed environment like a JVM)

To be helpful I tried the sync version and it worked from the background.

As an experiment, could you try creating a thread and invoke a sync method in it? Please let me know if that works.

Regards,
Mark

Sorry - I can’t spend much time digging into this. It is pretty trivial to reproduce. I’ve just worked around it on my end by ensuring I’m on the main thread before making this request. If in testing we find UI updates get negatively impacted by this I’m sure I’ll revisit this.

Well that is disingenuous marking this as “cannot reproduce” when you didn’t even try? It is very very easy to reproduce. Just have to have try to call your api from the background using GCD or thread?

That’s correct, I didn’t try, but it would be silly to assume that I do everything myself here. It was reported back to me and I reflected it in the status.

Just to make sure we’re talking about the same thing - the issue is with async calls in Grand Central Dispatch, is that correct?