|
@@ -20,8 +20,19 @@
|
|
|
if (! [ApexMobileDB initializeDb])
|
|
if (! [ApexMobileDB initializeDb])
|
|
|
// TODO: alert the user!
|
|
// TODO: alert the user!
|
|
|
DebugLog(@"couldn't init db");
|
|
DebugLog(@"couldn't init db");
|
|
|
- [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
|
|
|
|
|
|
|
|
|
|
|
|
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
|
|
|
|
|
+ {
|
|
|
|
|
+ UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge |UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
|
|
|
|
|
+ [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
|
|
|
|
|
+ [[UIApplication sharedApplication] registerForRemoteNotifications ];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIUserNotificationTypeBadge |UIUserNotificationTypeSound | UIUserNotificationTypeAlert];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
self.user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
|
|
self.user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
|
|
|
|
|
|
|
@@ -76,6 +87,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)pToken {
|
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)pToken {
|
|
|
|
|
+ NSString * sss=[NSString stringWithFormat:@"%@",pToken];
|
|
|
self.duid = [[[[NSString stringWithFormat:@"%@",pToken] substringWithRange:NSMakeRange(0, 72)] substringWithRange:NSMakeRange(1, 71)] stringByReplacingOccurrencesOfString:@" " withString:@""];
|
|
self.duid = [[[[NSString stringWithFormat:@"%@",pToken] substringWithRange:NSMakeRange(0, 72)] substringWithRange:NSMakeRange(1, 71)] stringByReplacingOccurrencesOfString:@" " withString:@""];
|
|
|
NSLog(@"regisger success:%@",pToken);
|
|
NSLog(@"regisger success:%@",pToken);
|
|
|
|
|
|