在我的应用中,我使用Mixpanel iPhone库来记录使用情况,并使用Firebase iOS SDK消息库来处理通知。
当iOS应用处于后台时,当用户点击通知吐司,应用启动但会在几秒钟后崩溃时,就会出现此问题。该失败似乎是来自Mixpanel的EXC_BAD_ACCESS
函数的mp_swizzledMethod_5
。
在挖掘调用堆栈时,我发现Mixpanel的mp_swizzledMethod_5和Firebase的FCM_swizzle_didReceiveNotificationResponseWithHandler无限地相互呼叫。请参阅调用堆栈的这一部分
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x0000000104f7a010 in is_interesting_event ()
#1 0x0000000104f7966c in gcd_queue_item_enqueue_hook ()
#2 0x00000001054bd1f0 in _dispatch_introspection_queue_item_enqueue_hook ()
#3 0x000000010548fa54 in dispatch_source_set_event_handler_f ()
#4 0x000000018256bce0 in ___lldb_unnamed_symbol372$$libsqlite3.dylib ()
#5 0x00000001824cb7a0 in ___lldb_unnamed_symbol18$$libsqlite3.dylib ()
#6 0x00000001824cb1d8 in ___lldb_unnamed_symbol17$$libsqlite3.dylib ()
#7 0x0000000182527f80 in ___lldb_unnamed_symbol159$$libsqlite3.dylib ()
#8 0x000000018252b878 in ___lldb_unnamed_symbol167$$libsqlite3.dylib ()
#9 0x000000018252b220 in ___lldb_unnamed_symbol164$$libsqlite3.dylib ()
#10 0x0000000182508048 in ___lldb_unnamed_symbol104$$libsqlite3.dylib ()
#11 0x00000001825037dc in sqlite3_step ()
#12 0x000000010480448c in -[FIRMessagingRmq2PersistentStore saveUnackedS2dMessageWithRmqId:] ()
#13 0x00000001048063e8 in -[FIRMessagingRmqManager saveS2dMessageWithRmqId:] ()
#14 0x00000001047ee768 in -[FIRMessaging appDidReceiveMessage:] ()
#15 0x0000000104802360 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
#16 0x000000010448388c in mp_swizzledMethod_5 at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/Mixpanel/MPSwizzler.m:85
#17 0x0000000104802380 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
#18 0x000000010448388c in mp_swizzledMethod_5 at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/Mixpanel/MPSwizzler.m:85
#19 0x0000000104802380 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
... thousands of lines of repeating calls
#6030 0x000000010448388c in mp_swizzledMethod_5 at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/Mixpanel/MPSwizzler.m:85
#6031 0x0000000104802380 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
#6032 0x000000010448388c in mp_swizzledMethod_5 at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/Mixpanel/MPSwizzler.m:85
#6033 0x0000000104802380 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
#6034 0x000000010448388c in mp_swizzledMethod_5 at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/Mixpanel/MPSwizzler.m:85
#6035 0x0000000104802380 in FCM_swizzle_didReceiveNotificationResponseWithHandler ()
#6036 0x000000018b8f6064 in -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] ()
#6037 0x000000018bb82af8 in -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] ()
#6038 0x000000018c3077c0 in __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke ()
#6039 0x000000018c307664 in -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] ()
#6040 0x000000018c0752cc in __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke ()
#6041 0x000000018c20e3cc in _performActionsWithDelayForTransitionContext ()
#6042 0x000000018c07517c in -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] ()
#6043 0x000000018be59760 in -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] ()
#6044 0x000000018bcfb2a8 in -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] ()
#6045 0x000000018478aca4 in __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 ()
#6046 0x000000010548d28c in _dispatch_client_callout ()
#6047 0x00000001054999e4 in _dispatch_block_invoke_direct ()
#6048 0x00000001847be7f8 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#6049 0x00000001847be49c in -[FBSSerialQueue _performNext] ()
#6050 0x00000001847bea38 in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#6051 0x000000018206f77c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#6052 0x000000018206f6fc in __CFRunLoopDoSource0 ()
#6053 0x000000018206ef84 in __CFRunLoopDoSources0 ()
#6054 0x000000018206cb5c in __CFRunLoopRun ()
#6055 0x0000000181f8cc58 in CFRunLoopRunSpecific ()
#6056 0x0000000183e38f84 in GSEventRunModal ()
#6057 0x000000018b6e55c4 in UIApplicationMain ()
#6058 0x00000001044b5b48 in main at /Users/allanhahaha/Documents/craig_ios/CraigAtWork/workdl/ios/workdl/main.m:14
#6059 0x0000000181aac56c in start ()
请帮助我了解可能需要解决的问题......提前致谢!
答案 0 :(得分:0)
想通了。 Firebase和Mixpanel都是混合通知处理程序,因此我通过添加
禁用了Mixpanel中的通知swizzler#define MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT 1
在Mixpanel.h
之前的@implementation Mixpanel
之上