From 779774abe001b9a1960c6b775ffd1e4191fb0424 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Tue, 14 Nov 2017 12:33:52 +0200 Subject: [PATCH 1/2] Fix crash on iOS where JS object that extend NSObject was not hold into memory. --- tns-core-modules/ui/frame/frame.ios.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tns-core-modules/ui/frame/frame.ios.ts b/tns-core-modules/ui/frame/frame.ios.ts index 3a7ca3632f..0ec01ba9b7 100644 --- a/tns-core-modules/ui/frame/frame.ios.ts +++ b/tns-core-modules/ui/frame/frame.ios.ts @@ -38,7 +38,7 @@ class NotificationObserver2 extends NSObject { }; } -const observer = NotificationObserver2.initWithCallback(handleNotification); +export observer = NotificationObserver2.initWithCallback(handleNotification); const notificationCenter = utils.ios.getter(NSNotificationCenter, NSNotificationCenter.defaultCenter); notificationCenter.addObserverSelectorNameObject(observer, "onReceive", UIApplicationDidChangeStatusBarFrameNotification, null); From c9b5122c1c68fc4ddb06cb3e3155451530b501f3 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Tue, 14 Nov 2017 12:39:43 +0200 Subject: [PATCH 2/2] TS fix --- tns-core-modules/ui/frame/frame.ios.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/ui/frame/frame.ios.ts b/tns-core-modules/ui/frame/frame.ios.ts index 0ec01ba9b7..a487fb2b67 100644 --- a/tns-core-modules/ui/frame/frame.ios.ts +++ b/tns-core-modules/ui/frame/frame.ios.ts @@ -38,9 +38,9 @@ class NotificationObserver2 extends NSObject { }; } -export observer = NotificationObserver2.initWithCallback(handleNotification); +export const __observer = NotificationObserver2.initWithCallback(handleNotification); const notificationCenter = utils.ios.getter(NSNotificationCenter, NSNotificationCenter.defaultCenter); -notificationCenter.addObserverSelectorNameObject(observer, "onReceive", UIApplicationDidChangeStatusBarFrameNotification, null); +notificationCenter.addObserverSelectorNameObject(__observer, "onReceive", UIApplicationDidChangeStatusBarFrameNotification, null); function handleNotification(notification: NSNotification): void { // When there is a 40px high "in-call" status bar, nobody moves the navigationBar top from 20 to 40 and it remains underneath the status bar.