Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Connect Due to NULL theReadStream #9

Closed
devinfoley opened this issue Nov 8, 2011 · 8 comments
Closed

Can't Connect Due to NULL theReadStream #9

devinfoley opened this issue Nov 8, 2011 · 8 comments

Comments

@devinfoley
Copy link

Hi,

First of all, thanks for this library! Unfortunately, I'm having trouble connecting.

When I execute the following code...

// Init pusher
NSLog(@"%@", @"Connecting to pusher...");
pusher = [PTPusher pusherWithKey:PUSHER_API_KEY delegate:self encrypted:YES];
pusher.reconnectAutomatically = YES;
[pusher connect];

I get the following error...

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: theReadStream != NULL'
*** Call stack at first throw:
(
0 CoreFoundation 0x0196b5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01abf313 objc_exception_throw + 44
2 CoreFoundation 0x01923ef8 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0165a3bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 [my app] 0x0005e502 -[AsyncSocket doCFReadStreamCallback:forStream:] + 242
5 [my app] 0x00057cf9 MyCFReadStreamCallback + 169

I've double checked everything and tried a few different parameters. Any ideas?

Thanks!
Devin

@lukeredpath
Copy link
Contributor

I'm unable to reproduce this; could you let me know a bit more detail. What SDK version are you building against, is this on a device or simulator?

@lukeredpath
Copy link
Contributor

Also, what kind of variable are you assigning the pusher object to in your snippet? Is it an instance variable? You'll probably want to retain it as pusherWithKey:delegate:encrypted: returns an auto-released object.

@devinfoley
Copy link
Author

Hi Luke,

Thanks for the response!

After writing this, I was able to get the Sample App to run just fine in the simulator. I still have the same issue in my app though. I am using a retain @Property for pusher, so I don't think that's the issue.

I get this error on both device and simulator. My Base SDK is "iOS 5.0".

Thanks!

@lukeredpath
Copy link
Contributor

Did you copy that snippet directly from your app? If so, you're assigning directly to the instance variable and not using the property setter.

@devinfoley
Copy link
Author

Thanks. That was the issue. I needed to use [self setPusher] so that it got the retain. I actually didn't know that, and figured that setting the property directly would have the same effect. Sorry for bothering with my n00b Objective C question, and thanks for the great support and lib!

@devinfoley
Copy link
Author

Closing...

@lukeredpath
Copy link
Contributor

You can also use self.myProperty = whatever which will implicitly call [self setMyProperty:whatever].

@devinfoley
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants