Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS App running on iOS 14 crashes every-time new push comes #1569 #163

Open
saurabh874 opened this issue Jul 30, 2020 · 31 comments · Fixed by #234
Open

iOS App running on iOS 14 crashes every-time new push comes #1569 #163

saurabh874 opened this issue Jul 30, 2020 · 31 comments · Fixed by #234
Assignees

Comments

@saurabh874
Copy link

Device iPhone X
version- iOS 14 beta version.

App is crashing every time once new push come.
anyone have solution for this.

@San10694
Copy link

San10694 commented Aug 25, 2020

Getting same issue, Can someone please check this , app is crashing on push only in iOS 14
getting this execption -

EXC_BREAKPOINTRNCPushNotificationIOS.m:273
drogonIOS/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.m:273:3 -[RNCPushNotificationIOS onFinishRemoteNotification:fetchResult:]

@sunweiyang
Copy link

sunweiyang commented Sep 16, 2020

iOS 14 is released today, and we're experiencing this in our production app right now. I'll try to do some investigating myself and report back here, but I am generally unfamiliar with the implementation of push-notification-ios. Would appreciate any insight the rest of the community can provide on this crash.

@sunweiyang
Copy link

The crash happens consistently when a push notification comes in on an iOS 14 device, in this code block (line 287 of RNCPushNotificationIOS.m):

Screen Shot 2020-09-16 at 10 43 34 PM

It seems that the crash is related to this addition to AppDelegate.m required by the push-notification-ios's README:

// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

When I comment out [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];, no crash occurs with iOS 14. But there may be unintended side effects? Maintainers and knowledgeable folks, please advise.

Here is the Xcode debug console output at the time of the crash:

2020-09-16 22:40:16.390423-0500 Skale[1427:180516] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
2020-09-16 22:40:16.390553-0500 Skale[1427:180516] [ProcessSuspension] 0x1175611c0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 1431, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
2020-09-16 22:40:16.397587-0500 Skale[1427:180516] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
2020-09-16 22:40:16.397667-0500 Skale[1427:180516] [ProcessSuspension] 0x117561240 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 1431, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
2020-09-16 22:40:23.704512-0500 Skale[1427:180688] [connection] nw_read_request_report [C8] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.710848-0500 Skale[1427:180688] [connection] nw_read_request_report [C23] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.711262-0500 Skale[1427:180688] [connection] nw_read_request_report [C15] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.711968-0500 Skale[1427:180688] [connection] nw_read_request_report [C14] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.715756-0500 Skale[1427:180688] [connection] nw_read_request_report [C21] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.716220-0500 Skale[1427:180688] [connection] nw_read_request_report [C17] Receive failed with error "Software caused connection abort"
2020-09-16 22:40:23.750165-0500 Skale[1427:180688] Connection 1: received failure notification
2020-09-16 22:40:23.750264-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C1 192.168.1.113:8081 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.750310-0500 Skale[1427:180688] [connection] nw_write_request_report [C1] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.773660-0500 Skale[1427:180688] Connection 16: received failure notification
2020-09-16 22:40:23.773720-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C16.1 52.205.86.27:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.773755-0500 Skale[1427:180688] [connection] nw_write_request_report [C16] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.774000-0500 Skale[1427:180688] Connection 18: received failure notification
2020-09-16 22:40:23.774857-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C18.1 52.205.86.27:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.775031-0500 Skale[1427:180688] [connection] nw_write_request_report [C18] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.775966-0500 Skale[1427:180688] Connection 19: received failure notification
2020-09-16 22:40:23.776011-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C19.1 52.205.86.27:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.776042-0500 Skale[1427:180688] [connection] nw_write_request_report [C19] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.777389-0500 Skale[1427:180688] Connection 20: received failure notification
2020-09-16 22:40:23.778188-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C20.1 52.205.86.27:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.778458-0500 Skale[1427:180688] [connection] nw_write_request_report [C20] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.778798-0500 Skale[1427:180688] Connection 24: received failure notification
2020-09-16 22:40:23.778835-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C24.2 20.185.73.23:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.778864-0500 Skale[1427:180688] [connection] nw_write_request_report [C24] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.781361-0500 Skale[1427:180688] Connection 27: received failure notification
2020-09-16 22:40:23.783075-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C27.1 20.185.73.23:443 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.783238-0500 Skale[1427:180688] [connection] nw_write_request_report [C27] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.783869-0500 Skale[1427:180688] Connection 13: received failure notification
2020-09-16 22:40:23.783911-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C13 192.168.1.113:8081 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.783943-0500 Skale[1427:180688] [connection] nw_write_request_report [C13] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.798754-0500 Skale[1427:180688] Connection 11: received failure notification
2020-09-16 22:40:23.798826-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C11 192.168.1.113:8081 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.798865-0500 Skale[1427:180688] [connection] nw_write_request_report [C11] Send failed with error "Socket is not connected"
2020-09-16 22:40:23.801061-0500 Skale[1427:180688] Connection 22: received failure notification
2020-09-16 22:40:23.801110-0500 Skale[1427:180688] [connection] nw_flow_add_write_request [C22 192.168.1.113:8081 failed channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] cannot accept write requests
2020-09-16 22:40:23.801142-0500 Skale[1427:180688] [connection] nw_write_request_report [C22] Send failed with error "Socket is not connected"

@sunweiyang
Copy link

sunweiyang commented Sep 17, 2020

@saurabh874 @San10694 the workaround I'm currently deciding on is to comment out line 287 of RNCPushNotificationIOS.m (completionHandler(result);). This allows the app to receive push notifications while avoiding crashes and keep the ability to trigger local notifications. There may still be some side effects that I'm not aware of; perhaps a maintainer can provide some insight?

@ysfzrn
Copy link

ysfzrn commented Sep 23, 2020

Same issue

@surafelbm
Copy link

same issue, any update?

@alex-mironov
Copy link

alex-mironov commented Oct 13, 2020

did anyone manage to solve it?

@ysfzrn
Copy link

ysfzrn commented Oct 13, 2020

#163 (comment) This workaround works for me but I suppose no new update

@blexxed
Copy link

blexxed commented Oct 14, 2020

@saurabh874 @San10694 the workaround I'm currently deciding on is to comment out line 287 of RNCPushNotificationIOS.m (completionHandler(result);). This allows the app to receive push notifications while avoiding crashes and keep the ability to trigger local notifications. There may still be some side effects that I'm not aware of; perhaps a maintainer can provide some insight?

Work around also worked for me.

@ghasemikasra39
Copy link

I am facing the same issue on react native 0.63.3, ios 14.0.1.

@Naturalclar Naturalclar self-assigned this Oct 25, 2020
@bneigher
Copy link

I am noticing this too on my app since ios 14

@Naturalclar
Copy link
Collaborator

Hello! I'm trying to address this issue with my iOS14 device, but I'm unable to reproduce the issue.
onFinishRemoteNotification mentioned in comment #163 (comment) seems to be called fine on my side.

Would someone be able to create a reproduction repo for this issue?

@saurabh874
Copy link
Author

saurabh874 commented Oct 26, 2020

@Naturalclar Yes Still we are facing same issue. and this issue is come only when app is in foreground.
Screenshot 2020-10-26 at 11 19 46 AM

@tmmgn
Copy link

tmmgn commented Oct 26, 2020

Hello! I'm trying to address this issue with my iOS14 device, but I'm unable to reproduce the issue.
onFinishRemoteNotification mentioned in comment #163 (comment) seems to be called fine on my side.

Would someone be able to create a reproduction repo for this issue?

You only need device on ios 14 and app in foreground receiving push

@Naturalclar
Copy link
Collaborator

Naturalclar commented Oct 26, 2020

I'm using a physical iOS 14.1 device (iPhone 7) tried both local notification and push notification (using Pusher), tried both foreground and background but the notification seems to work fine.
I'm using the example app in this repo.

@Naturalclar
Copy link
Collaborator

It will help if some one can provide a repository that will reproduce the crash so I could investigate further :)

@saurabh874
Copy link
Author

Hi @Naturalclar
it will very helpful if you to comment out line 287 of RNCPushNotificationIOS.m (completionHandler(result);)
because i comment out this line and it is perfectly working.

@tmmgn
Copy link

tmmgn commented Oct 28, 2020

tried on fresh RN 0.63.3 with GCM push notification - crash on every device with iOS 14+, maybe push provider is the reason

@tmmgn
Copy link

tmmgn commented Oct 30, 2020

btw on simulator push notifications works perfect even in foreground, got crash only in test flight and production

@HilaRaveh
Copy link

Any updates?
I'm also getting this on RN 0.59.9, iOS 14+, iPhone12,3

@DovletAmanov
Copy link

I have same issue, commenting completionHandler(result) is not safe solution.

@haileybee1231
Copy link

Also having the same issue on RN 0.61.4, iOS 14+. Was able to resolve by commenting the line recommended above, but following to see if the issue is resolved.

@Naturalclar
Copy link
Collaborator

I've released 1.7.5-beta.0 with potential fix for this.
I wasn't able to reproduce the crash with the original package, so could someone verify that this change fixes the crash?

@ysfzrn
Copy link

ysfzrn commented Nov 24, 2020

Sorry, 1.7.5-beta.0 didn't fix my problem.
After commenting out completionHandler(result) like before, crash didn't occur

Screen Shot 2020-11-24 at 14 40 48

@Naturalclar
Copy link
Collaborator

released v1.8.0 that should fix the issue

@sunweiyang
Copy link

Thanks @Naturalclar! Can you share what was the issue, and why moving completionHandler() resolves it?

@tmmgn
Copy link

tmmgn commented Nov 27, 2020

can confirm, version 1.8.0 not crashing anymore, but foreground push is not visible (event is firing)

@ysfzrn
Copy link

ysfzrn commented Nov 27, 2020

@tmmgn I'm using PushNotificationIOS.presentLocalNotification for iOS instead of PushNotification.localNotification , maybe it can resolve your problem.
I realized now, presentLocalNotification seems deprecated. I suppose, suggested new function is addNotificationRequest

@gabcvit
Copy link

gabcvit commented Nov 27, 2020

I was facing the same problem in one of my projects, it seems that Apple has changed some very important aspects of Push notifications which affected many apps out there. It was possible to fix this issue following the steps posted by the user "edelabar_pmd" on their official forum: https://developer.apple.com/forums/thread/660149

Although after following the changes in the link above I found out that all these errors were gone for users running the app on iOS 14.2. I imagine it could be a very strong lead to first try building the app in this version before trying to change anything in the code (as this probably seems to be Apple's mistake, not the library's).

@thuynt99
Copy link

thuynt99 commented Mar 1, 2021

if you use RN 0.63.2 and fire-base ver 5.6.x Please follow the following link. It worked for me !!!!
ios 14 tap push crash

@yogieeka
Copy link

i have same issue and solved with remove firebase messaging, in this case i remove @react-native-firebase/messaging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.