Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

add back device notif

roryclear2e89d6d30465
diff --git a/ios/clearcam/AppDelegate.m b/ios/clearcam/AppDelegate.m
index de253f9..a929993 100644
--- a/ios/clearcam/AppDelegate.m
+++ b/ios/clearcam/AppDelegate.m
@@ -89,6 +89,7 @@
}
}
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
@@ -118,6 +119,20 @@ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
}
}
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+ const unsigned char *dataBuffer = (const unsigned char *)[deviceToken bytes];
+ if (!dataBuffer) {
+ return;
+ }
+
+ NSMutableString *token = [NSMutableString stringWithCapacity:(deviceToken.length * 2)];
+ for (int i = 0; i < deviceToken.length; i++) {
+ [token appendFormat:@"%02x", dataBuffer[i]];
+ }
+ [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"device_token"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
@synthesize persistentContainer = _persistentContainer;
- (NSPersistentContainer *)persistentContainer {