OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
493 stars 262 forks source link

EXC_BAD_ACCESS KERN_PROTECTION_FAILURE UIApplicationDelegate+OneSignal.m #776

Closed Tavernari closed 1 year ago

Tavernari commented 3 years ago

Description: Both Sentry and Crashlytics are warning this error for some users, we are trying to figure out about that but we have no more idea how to investigate this.

We got this title EXC_BAD_ACCESS KERN_PROTECTION_FAILURE -[OneSignalAppDelegate oneSignalApplicationWillTerminate:]

Environment iOS 14.0.1 / 13.7.0 pod 'OneSignal', '>= 2.11.2', '< 3.0'

Steps to Reproduce Issue: I have no idea how to reproduce that error, we tried many ways but without success

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x1a9f46d9c lookUpImpOrForward
1  MyApp                            0x106ea8d74 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 240 (UIApplicationDelegate+OneSignal.m:240)
2  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
3  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
4  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
5  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
6  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
7  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
8  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
9  MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
10 MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
11 MyApp                            0x106ea8e18 -[OneSignalAppDelegate oneSignalApplicationWillTerminate:] + 242 (UIApplicationDelegate+OneSignal.m:242)
12 UIKitCore                      0x1ae2ce9a4 -[UIApplication _terminateWithStatus:]
13 UIKitCore                      0x1ada6c0d0 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
14 UIKitCore                      0x1ada6bd58 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
15 UIKitCore                      0x1ae2c4b44 -[UIApplication workspaceShouldExit:withTransitionContext:]
16 FrontBoardServices             0x1af3958a0 -[FBSUIApplicationWorkspaceShim workspaceShouldExit:withTransitionContext:]
17 FrontBoardServices             0x1af3c09bc __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke_2
18 FrontBoardServices             0x1af3a6bfc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
19 FrontBoardServices             0x1af3c094c __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke
20 libdispatch.dylib              0x1a9edb524 _dispatch_client_callout
21 libdispatch.dylib              0x1a9eb5808 _dispatch_block_invoke_direct$VARIANT$armv81
22 FrontBoardServices             0x1af3e5850 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
23 FrontBoardServices             0x1af3e551c -[FBSSerialQueue _queue_performNextIfPossible]
24 FrontBoardServices             0x1af3e5a44 -[FBSSerialQueue _performNextFromRunLoopSource]
25 CoreFoundation                 0x1aa193ad8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
26 CoreFoundation                 0x1aa193a30 __CFRunLoopDoSource0
27 CoreFoundation                 0x1aa1931b8 __CFRunLoopDoSources0
28 CoreFoundation                 0x1aa18e1e8 __CFRunLoopRun
29 CoreFoundation                 0x1aa18dba8 CFRunLoopRunSpecific
30 GraphicsServices               0x1b4304344 GSEventRunModal
31 UIKitCore                      0x1ae2c93e4 UIApplicationMain
32 MyApp                            0x105189d98 main + 13 (Injection.swift:13)
33 libdyld.dylib                  0x1aa0158f0 start
emawby commented 3 years ago

Thank you for the report, I am investigating the issue now

emawby commented 3 years ago

@Tavernari Is your app, or another library in your app, also swizzling applicationWillTerminate. If you aren't sure then could send a list of libraries (and their versions) that are being used in your app?

Have you seen any other crashes on different methods that are being swizzled in UIApplicationDelegate+OneSignal.mor is it just applicationWillTerminate?

Also when trying to reproduce are you sure that you have gotten applicationWillTerminate to trigger?

Tavernari commented 3 years ago

I got three different reports with different lines, but if you enter inside those reports the structure of the stack trace is the same for all reports only changing the first item.

This project is an application.

Screenshot 2020-10-21 at 15 45 49

MyApp podfile

workspace 'MyApp'

platform :ios, '11.0'

target 'MyApp' do
  project 'MyApp/MyApp.xcodeproj/'
  use_frameworks!

  pod 'JNKeychain', '0.1.4'
  pod 'TLCustomMask', '2.0.0'
  pod 'PopupDialog','1.1.1'
  pod 'Siren', '5.5.0'
  pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '5.2.0'
  pod 'GoogleMLKit/BarcodeScanning','0.61.0'
  pod 'Firebase/Analytics', '6.28.1'
  pod 'Firebase/Crashlytics'
  pod 'lottie-ios','3.1.8'

  pod 'SwiftLint','0.39.2'
  pod 'Apollo','0.29.1'
  pod 'R.swift','5.2.2'
  pod 'FSCalendar', '2.8.1'

  pod 'OceanComponents', '1.0.0-beta.14'
  pod 'Swinject', '2.7.1'
  pod 'IQKeyboardManagerSwift', '6.5.5'
  pod 'Mixpanel-swift'
  pod 'Lytics', '0.0.2'
  pod 'OneSignal', '>= 2.11.2', '< 3.0'
  pod 'RNCryptor', '~> 5.0'
  pod 'SwiftOTP'

  target 'OneSignalNotificationServiceExtension' do
    pod 'OneSignal', '>= 2.11.2', '< 3.0'
  end

  target 'MyAppTests' do
    inherit! :search_paths
    pod 'SwiftyMocky','3.5.0'
    pod 'OceanComponents', '1.0.0-beta.14'
  end
end

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
            config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
        end
    end
end
Tavernari commented 3 years ago

I put flush call on AppDelegate applicationWillTerminate, so my friend told me that he got the crash flow, he just close the app and tries to open again, after that on start the application its crash instantly. Maybe I can't use Flush when the application will terminate

emawby commented 1 year ago

I apologize for not following up on this I am going to close due to inactivity