iOS 推送器不工作,客户端未连接
iOS Pusher doesn't work, client not connecting
这是给 www.pusher.com 的。
iOS他们提供的lib是libPusher。安装并按照第一步操作后,它就是不工作。我听说有几个人成功了。这个库是否仍然存在,或者它不支持更新版本的 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);
我已经实现了委托方法来跟踪状态。 [client connect]
调用后,委托方法:- (BOOL)pusher:(PTPusher *)pusher connectionWillConnect:(PTPusherConnection *)connection
被触发,但此后什么也没有发生。没有错误消息,没有成功消息。由于 clint 未连接,该频道也未订阅。
我已经在 JS 上实现了 pusher 并且它起作用了。因为我所做的是非常基本的客户端连接,我无能为力(至少从文档中),所以我假设这个库可能不再工作了。
我当时很蠢,忽略了文档中说推送客户端应该是 strong
。因此,解决方案应该是:
@property(nonatomic) PTPusher *client;
self.client = [PTPusher ...];
...
这是给 www.pusher.com 的。
iOS他们提供的lib是libPusher。安装并按照第一步操作后,它就是不工作。我听说有几个人成功了。这个库是否仍然存在,或者它不支持更新版本的 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);
我已经实现了委托方法来跟踪状态。 [client connect]
调用后,委托方法:- (BOOL)pusher:(PTPusher *)pusher connectionWillConnect:(PTPusherConnection *)connection
被触发,但此后什么也没有发生。没有错误消息,没有成功消息。由于 clint 未连接,该频道也未订阅。
我已经在 JS 上实现了 pusher 并且它起作用了。因为我所做的是非常基本的客户端连接,我无能为力(至少从文档中),所以我假设这个库可能不再工作了。
我当时很蠢,忽略了文档中说推送客户端应该是 strong
。因此,解决方案应该是:
@property(nonatomic) PTPusher *client;
self.client = [PTPusher ...];
...