Skip to content

Commit 0a130ed

Browse files
authored
Merge pull request #237 from Unity-Technologies/fix-crash-ios
Fix occasional crash on iOS
2 parents b90b53d + d028e37 commit 0a130ed

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

com.unity.mobile.notifications/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this package will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Fixes:
8+
- [iOS] - Fix occasional crash when registering for push notifications.
9+
510
## [2.1.0] - 2022-09-23
611

712
### Changes & Improvements:

com.unity.mobile.notifications/Runtime/iOS/Plugins/UnityNotificationManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ - (void)finishRemoteNotificationRegistration:(UNAuthorizationStatus)status notif
5252
{
5353
struct iOSNotificationAuthorizationData authData;
5454
authData.granted = status == UNAuthorizationStatusAuthorized;
55+
authData.error = NULL;
56+
authData.deviceToken = NULL;
5557
NSString* deviceToken = nil;
5658
if (authData.granted)
5759
{
5860
deviceToken = [UnityNotificationManager deviceTokenFromNotification: notification];
5961
authData.deviceToken = [deviceToken UTF8String];
6062
}
61-
authData.error = NULL;
6263

6364
[_lock lock];
6465
_remoteNotificationsRegistered = status;

0 commit comments

Comments
 (0)