Closed jackjpark closed 5 years ago
I have reverted to manual push notification handling to get around these swizzling crashes but there is a lack of documentation on how to support the webview and deeplink exponea push notifications when not using the automatic tracking...
Can you either provide guidance on handling this, or offer insight as to why the swizzling is causing so many fatals? thanks
Hi @jackjpark, can you please tell me how have you setup push notifications in your project? Which app delegate or UNUserNotifications delegate methods have you overridden?
Hi @jackjpark, can you please tell me how have you setup push notifications in your project? Which app delegate or UNUserNotifications delegate methods have you overridden?
Yep sure, so the ApplicationController inits a UserNotificationCenter
on app start, which conforms to UNUserNotificationCenterDelegate
and takes UNUserNotificationCenter.current()
injection on init where it sets its delegate to our UserNotificationCenter
class
I also override didReceiveRemoteNotification
and didRegisterForRemoteNotificationsWithDeviceToken
and send them to my PushNotificationController
wrapper to handle them within the context of our app flows
@jackjpark Ok, thanks. Is this happening before or after initialising Exponea?
Also, in the crash, can you see where did the crash originate from? Could you possibly share a log?
@jackjpark Ok, thanks. Is this happening before or after initialising Exponea?
We always init exponea on startup now so its always running (got rid of the lazy init when working on the previous issue), so when receiving a push, exponea would always have been initialised. Ill crash the app and provide a log in a minute as it takes some setup
All im able to see if the fatal on:
guard let originalMethod = class_getInstanceMethod(type(of: self), selector), let swizzle = Swizzler.swizzles[originalMethod] else { return }
on
func userNotificationCenter(_ center: UNUserNotificationCenter, newDidReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
Here is a log from a couple of days ago as i cant see any new logs, i think its related to this same issue:
Incident Identifier: 1A986036-1A40-4DB1-ADCC-76C94D4D78F7 CrashReporter Key: ccf024342b29dcc79d6fc45cb909da4d946a58c0 Hardware Model: iPhone10,6 Version: 4591 (3.14.0) Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd [1]
Date/Time: 2019-02-25 15:04:17.0822 +0000 Launch Time: 2019-02-25 14:56:46.5783 +0000 OS Version: iPhone OS 12.1.2 (16C101) Baseband Version: 2.02.02 Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016d917f90
VM Region Info: 0x16d917f90 is in 0x16d914000-0x16d918000; bytes after start: 16272 bytes before end: 111
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_TINY 000000014c900000-000000014ca00000 [ 1024K] rw-/rwx SM=PRV
GAP OF 0x20f14000 BYTES
---> STACK GUARD 000000016d914000-000000016d918000 [ 16K] ---/rwx SM=NUL ... for thread 0
Stack 000000016d918000-000000016da14000 [ 1008K] rw-/rwx SM=PRV thread 0
Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [55550] Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001b819dc40 NXHashMember + 0
1 libobjc.A.dylib 0x00000001b81b0c54 isKnownClass+ 89172 (objc_class*) + 72
2 libobjc.A.dylib 0x00000001b81ac870 lookUpImpOrForward + 144
3 libobjc.A.dylib 0x00000001b81ac6c4 classgetInstanceMethod + 68
4 ExponeaSDK 0x0000000106034f90 NSObject.userNotificationCenter(:newDidReceive:withCompletionHandler:) + 348048 (PushNotificationManager+NSObject.swift:18)
5 ExponeaSDK 0x00000001060354d0 @objc NSObject.userNotificationCenter(:newDidReceive:withCompletionHandler:) + 349392 (
I have encountered a further Issue when sending a push notification, when user taps the notification, app opens and then fatal error occurs in SDK:
Fatal on this line of the
PushNotificationManager+NSObject
class:guard let originalMethod = class_getInstanceMethod(type(of: self), selector), let swizzle = Swizzler.swizzles[originalMethod] else { return }
also appears to call this func over and over in the stack trace
curriedImplementation(self, selector, center, response, completionHandler)
Is there any additional config required in the app when NOT using rich push notifications? As the demo app implies not but why is this crash occurring if thats the case? Appreciate guidance on this