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

Method Swizzling Causes Conflict with New Relic #86

Open
TheNorthEestern opened this issue Sep 28, 2023 · 0 comments
Open

Method Swizzling Causes Conflict with New Relic #86

TheNorthEestern opened this issue Sep 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@TheNorthEestern
Copy link

TheNorthEestern commented Sep 28, 2023

Expected Behavior

Tracking should begin seamlessly at app launch.

Current Behavior

When launching with screenViews set to true, the call to amp_viewDidAppear triggers an exception in New Relic profiler.

Possible Solution

Potentially use an alternative to swizzling that doesn't trigger other SDKs? (Not sure if this is possible)

Steps to Reproduce

  1. Install Amplitude-Swift 0.6.0 alongside New Relic 7.4.6
  2. When initializing Amplitude-Swift, pass true for tracking screenViews (e.g. DefaultTrackingOptions(screenViews: true))
  3. Attempt to start your application.
  4. Observe the error thrown

Thread 1: "New Relic detected an unrecognized selector, 'amp_viewDidAppear:', sent to 'UIViewController'. It's possible _cmd was renamed by an unsafe method_exchangeImplementations()."

*** Terminating app due to uncaught exception 'NRInvalidArgumentException', reason: 'New Relic detected an unrecognized selector, 'amp_viewDidAppear:', sent to 'UIViewController'. It's possible _cmd was renamed by an unsafe method_exchangeImplementations().'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001803f3d70 __exceptionPreprocess + 236
	1   libobjc.A.dylib                     0x000000018019814c objc_exception_throw + 56
	2   NewRelic                            0x0000000114f05d68 NRMA__beginMethod + 744
	3   NewRelic                            0x0000000114f0632c NRMA__boolParamHandler + 56
	4   Argon                               0x00000001043f5e78 $sSo16UIViewControllerC14AmplitudeSwiftE17amp_viewDidAppearyySbF + 72
	5   Argon                               0x00000001043f6980 $sSo16UIViewControllerC14AmplitudeSwiftE17amp_viewDidAppearyySbFTo + 40
	6   UIKitCore                           0x000000018463e258 -[UIViewController _setViewAppearState:isAnimating:] + 832
	7   UIKitCore                           0x000000018463ec88 -[UIViewController __viewDidAppear:] + 168
	8   UIKitCore                           0x000000018463ef88 -[UIViewController _endAppearanceTransition:] + 248
	9   UIKitCore                           0x0000000184518f90 __48-[UIPresentationController transitionDidFinish:]_block_invoke + 140
	10  UIKitCore                           0x0000000185294438 -[_UIAfterCACommitBlock run] + 64
	11  UIKitCore                           0x000000018529490c -[_UIAfterCACommitQueue flush] + 188
	12  UIKitCore                           0x0000000184d97a0c _runAfterCACommitDeferredBlocks + 640
	13  UIKitCore                           0x0000000184d87430 _cleanUpAfterCAFlushAndRunDeferredBlocks + 128
	14  UIKitCore                           0x0000000184dba204 _afterCACommitHandler + 76
	15  CoreFoundation                      0x0000000180360f10 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
	16  CoreFoundation                      0x000000018035b5a4 __CFRunLoopDoObservers + 572
	17  CoreFoundation                      0x000000018035baf8 __CFRunLoopRun + 968
	18  CoreFoundation                      0x000000018035b218 CFRunLoopRunSpecific + 572
	19  GraphicsServices                    0x000000018c25f60c GSEventRunModal + 160
	20  UIKitCore                           0x0000000184d88a98 -[UIApplication _run] + 992
	21  UIKitCore                           0x0000000184d8d634 UIApplicationMain + 112
	22  Argon                               0x0000000102990998 main + 64
	23  dyld                                0x000000011475dcd8 start_sim + 20
	24  ???                                 0x00000001148e9f28 0x0 + 4639858472
	25  ???                                 0xaf5b000000000000 0x0 + 12635693179518058496
)
libc++abi: terminating with uncaught exception of type NSException

Environment

  • SDK Version: 0.6.0
  • OS Info: iOS 15.x, iOS 16.x
@TheNorthEestern TheNorthEestern added the bug Something isn't working label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant