Why is synchronousRemoteObjectProxyWithErrorHandler asynchronous?!

Unless I'm missing something (always possible)... there is no way to tell if you get a valid proxy back -- the error handler is asynchronous, and I don't see a way to say "this proxy is valid."

Am I missing something?

Answered by kithrup in 707994022

No I'm stupid! I think I understand it now: the error handler is called on a later error. But, in my case, it's happening very shortly after I create the proxy, and that is what confused the heck out of me.

Oy with the poodles!

Wait now it's even weirder. It's only sometimes asynchronous?

Accepted Answer

No I'm stupid! I think I understand it now: the error handler is called on a later error. But, in my case, it's happening very shortly after I create the proxy, and that is what confused the heck out of me.

Oy with the poodles!

there is no way to tell if you get a valid proxy back

The returned proxy itself is always valid. What you don’t know is whether a request to that proxy will work, and the only way to tel that is to issue the request [1].

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] You could create a ‘preflight’ request if you like, but that just creates a race condition, in that the service you’re talking to could fail between the preflight request and the actual request.

As I said in my subsequent messages, I did figure it out -- I was being really dumb, for quite a long time. In retrospect, I can't see how I can remember which pant leg goes with which leg, honestly. ;)

The truly ironic thing was that I was looking for a proxy equivalent to the invalidation handler for the connection, and it turns out I had the whole time, I was just dumb.

Why is synchronousRemoteObjectProxyWithErrorHandler asynchronous?!
 
 
Q