And anotehr try... narf
This commit is contained in:
parent
3e4a5f606e
commit
ef80e68d41
@ -26,10 +26,22 @@
|
|||||||
|
|
||||||
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||||
NSLog(@"Did Register for Remote Notifications with Device Token (%@)", deviceToken);
|
NSLog(@"Did Register for Remote Notifications with Device Token (%@)", deviceToken);
|
||||||
NSString *token = [self hexadecimalStringFromData:deviceToken];
|
NSString *token = [self stringFromDeviceToken:deviceToken];
|
||||||
PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(token));
|
PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSString *)stringFromDeviceToken:(NSData *)deviceToken {
|
||||||
|
NSUInteger length = deviceToken.length;
|
||||||
|
if (length == 0) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
const unsigned char *buffer = (const unsigned char*)deviceToken.bytes;
|
||||||
|
NSMutableString *hexString = [NSMutableString stringWithCapacity:(length * 2)];
|
||||||
|
for (int i = 0; i < length; ++i) {
|
||||||
|
[hexString appendFormat:@"%02x", buffer[i]];
|
||||||
|
}
|
||||||
|
return [hexString copy];
|
||||||
|
}
|
||||||
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
|
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
|
||||||
NSLog(@"Did Fail to Register for Remote Notifications");
|
NSLog(@"Did Fail to Register for Remote Notifications");
|
||||||
NSLog(@"%@, %@", error, error.localizedDescription);
|
NSLog(@"%@, %@", error, error.localizedDescription);
|
||||||
|
|||||||
Reference in New Issue
Block a user