SnowWolf
SnowWolf

Reputation: 469

iOS Pusher doesn't work, client not connecting

This is for www.pusher.com.

iOS lib they provided is libPusher. After I installed and follow the first step, it just not working. I've heard a few people make it work. Is this library still alive or it doesn't support newer version of iOS?

PTPusher *client = [PTPusher pusherWithKey:@"app-key" delegate:self encrypted:NO]; // I assume this is "key" not "secret" there.
[client connect];

PTPusherChannel *channel = [client subscribeToChannelNamed:@"test"];
NSLog(@"Channel: %@, %d", channel, channel.isSubscribed);

I've implemented delegate methods to track status. After [client connect] called, the delegate method: - (BOOL)pusher:(PTPusher *)pusher connectionWillConnect:(PTPusherConnection *)connection trigged, but then nothing happened after this. No error messages, no success messages. Since the clint is not connecting, the channel is not subscribed either.

I've implemented pusher on JS and it worked. Since what I did is very basic client connection and there is nothing I can do about (At least from documents), so I assume maybe this library just not working anymore.

Upvotes: 1

Views: 759

Answers (1)

SnowWolf
SnowWolf

Reputation: 469

I was being dumb and ignored that the document said pusher client should be strong. Therefore, the solution should be:

@property(nonatomic) PTPusher *client;

self.client = [PTPusher ...];
...

Upvotes: 1

Related Questions