What does this mean?


#1

I’m working on the section “Connecting to Apple’s server with NSStream”, which starts on p. 488. My CocoaServer app ran and in the console I saw the messages as expected and shown on p. 493. However the next time I ran it, I got this in the console:

<NSCFInputStream: 0x1036078b0> is open
<NSCFOutputStream: 0x103607980> is open
<NSCFInputStream: 0x1036078b0> error: Error Domain=NSOSStatusErrorDomain Code=-9825 UserInfo=0x100667610 "The operation couldn’t be completed. (OSStatus error -9825.)"
<NSCFOutputStream: 0x103607980> error: Error Domain=NSOSStatusErrorDomain Code=-9825 UserInfo=0x100667610 "The operation couldn’t be completed. (OSStatus error -9825.)"

Now this is all I get. At this point it’s dead in the water, so to speak–without the streams, I can’t push data in the next section. I can’t find anything on the net about this error code. What’s going on?


#2

Hmph. I just kept trying periodically without any code changes at all, and it suddenly started working again. I think I’m going to attribute this to a hiccup at Apple’s server end.


#3

Have suddenly got the same problem. What I found is, that the message is gone as soon as I allow all programs to access the dev key in my keychain (nevertheless I don’t get the message delivered getting no error at all). If I change the key access back to “Access only after warning” (translated from German, don’t know the exact text in English OS) the error message comes back. But earlier this change was not neccessary?!?
André


#4

I was hitting this too, at various times over the past three days. Now it’s working again, and all I recall doing between when it failed and when it worked was fixing two or three leaks that were reported by the analyzer. I don’t believe the leak fixes have anything to do with the functionality change, but I haven’t tested. I don’t really have any advice on what to do if you run into this NSInputStream/NSOutputStream issue. If it comes up again, I’ll try to do more debugging.


#5

I found the same problem when stepping through the connection code using the debugger.
But running at full speed w/o any debugging stops seems to work. Since there is more than
one thread running, perhaps it is a sync problem. Also you might try having the keyChain access
application open as you should be asked if access is to be allowed.

Later -
After further testing I found a most curious result. If you comment out the code that
starts and runs the NSNetService, the connection to the notification server always
succeeds! But if the NSNetService code runs, I get this failure quite often.
(And now I am not sure that having keyChain access open has any effect.)


#6

It might be a timing problem. I added a thread sleep between publishing the service, and connecting to the APNS

not pretty, but it will do for now!