From ac3c895c89a7398f6c5faa64243fd7280fdd544d Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Tue, 14 Nov 2017 13:36:23 +0200 Subject: [PATCH] Fix crash on iOS (#5071) * Fix crash on iOS where JS object that extend NSObject was not hold into memory. * 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 3a7ca3632..a487fb2b6 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 { }; } -const 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.