nativescript-local-notifications icon indicating copy to clipboard operation
nativescript-local-notifications copied to clipboard

iOS 14, App crash when notification received

Open zabi90 opened this issue 3 years ago • 13 comments

Hi, I installed this plug-in in brand new angular share project. When notification received inside app it is crashing. I'm assuming this plug might not update at iOS 14. When app is in background it is show notification. Thanks

zabi90 avatar Oct 07 '20 13:10 zabi90

i got this issue too

Philntps avatar Oct 19 '20 06:10 Philntps

I am also seeing this issue. Works when app is running in background. When app is open the app crashes when the notification is supposed to be received. Also on iOS 14

belugasanity avatar Oct 22 '20 05:10 belugasanity

any updates?

georgemark0v avatar Dec 08 '20 15:12 georgemark0v

@EddyVerbruggen I am also having the same issue where iOS crashes if the notification is scheduled and app is in foreground. Is there a work around at the moment for iOS? Thank you.

rob4226 avatar Jan 07 '21 18:01 rob4226

@EddyVerbruggen . We are also facing same issue. Any update or any work around?

faisalansari20 avatar Jan 13 '21 13:01 faisalansari20

@EddyVerbruggen, Please please help on this, this actually big issue with this plugin, coz commonly most of IOS is on 14.0 now and we just lacking the benefit of functionality, please help us.... :(

uidhtml avatar Jan 16 '21 05:01 uidhtml

I wish I had the bandwidth to take a look, but maybe it helps to switch to the N7-compatible version (see the top of the repo)? If that doesn't crash then there must be a recent change in that repo which fixes the issue and we can do a simple PR.

EddyVerbruggen avatar Jan 16 '21 08:01 EddyVerbruggen

I wish I had the bandwidth to take a look, but maybe it helps to switch to the N7-compatible version (see the top of the repo)? If that doesn't crash then there must be a recent change in that repo which fixes the issue and we can do a simple PR.

Compitable to NS 7+ as well as Downgraded the v 4.2.1, but got same.. :(, and one more issue could not list, listing now, "The Local Notifications plugin allows your app to show notifications when the app is not running. " app unable to show notifications when we kill app just after scheduling, know you don't have bandwidth, but requesting.. :)

uidhtml avatar Jan 16 '21 13:01 uidhtml

@uidhtml I feel you, I've been trying to figure this out all week. I'm having a hard time bc there's no errors/exceptions to go off of. Even debugging in xcode all I got was:

->  0x10c74bb79: .long  0x01046c30                ; unknown opcode  Thread 1: EXC_BAD_ACCESS (code=257, address=0x10c74bb79)
    0x10c74bb7d: udf    #0x0
    0x10c74bb81: cmphs  p0.b, p0/z, z0.b, z0.b
    0x10c74bb85: stlur  x0, [x0]
    0x10c74bb89: .long  0x010a78bb                ; unknown opcode
    0x10c74bb8d: str    w0, [x0]
    0x10c74bb91: .long  0x010c9d7c                ; unknown opcode
    0x10c74bb95: str    w0, [x0]

The only thing I can think of is that it has something to do with the userNotificationCenterWillPresentNotificationWithCompletionHandler because that is what gets called when the app is in the foreground.

rob4226 avatar Jan 16 '21 21:01 rob4226

Thanks Rob, for an update, let me look into it, hope I can reach to actual solution.. :)

Thanks Again, Uidhtml

On Sun, 17 Jan, 2021, 3:08 am Rob, [email protected] wrote:

@uidhtml https://github.com/uidhtml I feel you, I've been trying to figure this out all week. I'm having a hard time bc there's no errors/exceptions to go off of. Even debugging in xcode all I got was:

-> 0x10c74bb79: .long 0x01046c30 ; unknown opcode Thread 1: EXC_BAD_ACCESS (code=257, address=0x10c74bb79) 0x10c74bb7d: udf #0x0 0x10c74bb81: cmphs p0.b, p0/z, z0.b, z0.b 0x10c74bb85: stlur x0, [x0] 0x10c74bb89: .long 0x010a78bb ; unknown opcode 0x10c74bb8d: str w0, [x0] 0x10c74bb91: .long 0x010c9d7c ; unknown opcode 0x10c74bb95: str w0, [x0]

The only thing I can think of is that it has something to do with the userNotificationCenterWillPresentNotificationWithCompletionHandler because that is what gets called when the app is in the foreground.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-local-notifications/issues/201#issuecomment-761679682, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBXRTBN4LWFYITWM34YLDTS2IBMFANCNFSM4SHL2CSQ .

uidhtml avatar Jan 17 '21 06:01 uidhtml

Thanks Uidhtml. I will keep trying also bc I also really need this.

rob4226 avatar Jan 17 '21 19:01 rob4226

Cool, thanks!

On Mon, 18 Jan, 2021, 1:12 am Rob, [email protected] wrote:

Thanks Uidhtml. I will keep trying also bc I also really need this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-local-notifications/issues/201#issuecomment-761868072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBXRTDAIPZBYLVSW6K7Q2DS2M4RHANCNFSM4SHL2CSQ .

uidhtml avatar Jan 18 '21 05:01 uidhtml

@EddyVerbruggen @uidhtml So it appears that userNotificationCenterWillPresentNotificationWithCompletionHandler really is where the problem is. I narrowed it down to calling completionHandler() is what crashes the app on iOS. If you don't call it, the app won't crash, but you won't get a notification either. I tried just calling completionHandler(1) or completionHandler(4) but it still crashes right away.

@EddyVerbruggen Do you have any ideas why calling completionHandler() would cause a crash? Thanks!

/**
     * Called when the app is in the foreground.
     */
    userNotificationCenterWillPresentNotificationWithCompletionHandler(center, notification, completionHandler, next) {
        if (notification.request.content.userInfo.valueForKey('__NotificationType') !== 'nativescript-local-notifications' || notification.request.trigger instanceof UNPushNotificationTrigger) {
            next();
            return;
        }
        this.receivedInForeground = true;
        if (notification.request.content.userInfo.valueForKey('forceShowWhenInForeground') || notification.request.content.userInfo.valueForKey('priority')) {
            completionHandler(1 /* Badge */ | 2 /* Sound */ | 4 /* Alert */);
        }
        else {
            completionHandler(1 /* Badge */ | 2 /* Sound */);
        }
    }

rob4226 avatar Jan 28 '21 04:01 rob4226