backbeam/BackbeamFramework — pull request #2 by albertovelazmoliner (2013-08-17 01:13:29+00:00)
Title: Fixed possible bug in process for getting  be subscribed to push-notification cha...

...nnels in first time launch of the app.
At first time you launch the app, the first method called in Backbeam.m is:
- (id)initInstance
{
self = [super init];
if (self) {
....
self.deviceToken = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
.....
}
return self;
}
And in this first time, the result is always nil, so we have self.deviceToken as nil.
Later is called this method:
- (void)persistDeviceToken:(NSData*)data {
NSString* base64 = [data base64EncodedString];
NSString* path = [self.basePath stringByAppendingPathComponent:kDeviceTokenPathComponent];
// TODO: handle error
[base64 writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
But the new value is not assigned to self.deviceToken, so whenever you want to suscribe your app to push-notifications chanels with this methods:

+ (void)subscribeToChannels:(NSArray*)channels
success:(SuccessBlock)success
failure:(FailureBlock)failure;

+ (void)subscribeToChannels:(NSArray*)channels;

+ (void)subscribedChannels:(SuccessArrayBlock)success
failure:(FailureBlock)failure;
+ (void)unsubscribeFromAllChannels:(SuccessBlock)success
failure:(FailureBlock)failure;

+ (void)unsubscribeFromChannels:(NSArray*)channels
success:(SuccessBlock)success
failure:(FailureBlock)failure;
+ (void)unsubscribeFromChannels:(NSArray*)channels;

you get always this message from log:
"UnknownDeviceToken"