react-native-purchases icon indicating copy to clipboard operation
react-native-purchases copied to clipboard

react-native IOS crashing on refresh with the simulator: NSInternalInconsistencyException

Open HilSny opened this issue 7 months ago • 2 comments

Describe the bug After upgrading from 8.10 to 8.11.6 I get a crash every time I fast refresh or manually refresh the simulator. Here is the stack trace

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: Purchases-LogHandlerEvent with body: {
    logLevel = DEBUG;
    message = "\U2139\Ufe0f LogInOperation: Started";
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNPurchases, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
	0   CoreFoundation                      0x00000001804b910c __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180092da8 objc_exception_throw + 72
	2   Foundation                          0x0000000180e67e68 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
	3   APP.debug.dylib             				0x000000010822b64c -[RCTEventEmitter sendEventWithName:body:] + 380
	4   APP.debug.dylib              				0x000000010805a418 __28-[RNPurchases setLogHandler]_block_invoke + 80
	5   APP.debug.dylib             				0x0000000107f782a0 $sSo12NSDictionaryCIeyBy_SDyS2SGIegg_TR + 60
	6   APP.debug.dylib              				0x0000000107f781b8 $s21PurchasesHybridCommon0C13FunctionalityC12setLogHander02onF8ReceivedyySDyS2SGc_tFZy10RevenueCat0F5LevelO_SStcfU_ + 332
	7   APP.debug.dylib             				0x0000000108a1b15c $s10RevenueCat9PurchasesC10logHandleryyAA8LogLevelO_SStcvsZyAF_S2SSgAGSutcfU_ + 152
	8   APP.debug.dylib              				0x0000000108a33850 $s10RevenueCat9PurchasesC10logHandleryyAA8LogLevelO_SStcvsZyAF_S2SSgAGSutcfU_TA + 36
	9   APP.debug.dylib              				0x0000000108a1b92c $s10RevenueCat9PurchasesC17verboseLogHandleryyAA0E5LevelO_S2SSgAGSutcvsZyAF_S2SA2GSutcfU_ + 216
	10  APP.debug.dylib              				0x0000000108a338cc $s10RevenueCat9PurchasesC17verboseLogHandleryyAA0E5LevelO_S2SSgAGSutcvsZyAF_S2SA2GSutcfU_TA + 52
	11  APP.debug.dylib              				0x00000001087b64bc $s10RevenueCat6LoggerV3log5level6intent7message8fileName08functionI04lineyAA8LogLevelO_AA0L6IntentOAA0L7Message_pyXKSSSgAPSutFZ + 872
	12  APP.debug.dylib              				0x00000001087b5ccc $s10RevenueCat6LoggerV5debug_8fileName08functionF04lineyAA10LogMessage_pyXK_SSSgAISutFZ + 152
	13  APP.debug.dylib              				0x00000001087c8fbc $s10RevenueCat16NetworkOperationC3logyys23CustomStringConvertible_pF + 196
	14  APP.debug.dylib              				0x00000001087c9d04 $s10RevenueCat16NetworkOperationC4mainyyF + 248
	15  APP.debug.dylib              				0x00000001087ca048 $s10RevenueCat16NetworkOperationC4mainyyFTo + 36
	16  Foundation                          0x0000000180eeda8c __NSOPERATION_IS_INVOKING_MAIN__ + 12
	17  Foundation                          0x0000000180ee9ff0 -[NSOperation start] + 620
	18  Foundation                          0x0000000180eee200 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 12
	19  Foundation                          0x0000000180eedf08 __NSOQSchedule_f + 168
	20  libdispatch.dylib                   0x00000001028caf60 _dispatch_block_async_invoke2 + 104
	21  libdispatch.dylib                   0x00000001028ba5d0 _dispatch_client_callout + 16
	22  libdispatch.dylib                   0x00000001028bda80 _dispatch_continuation_pop + 752
	23  libdispatch.dylib                   0x00000001028bca1c _dispatch_async_redirect_invoke + 896
	24  libdispatch.dylib                   0x00000001028ce4b0 _dispatch_root_queue_drain + 372
	25  libdispatch.dylib                   0x00000001028cf058 _dispatch_worker_thread2 + 256
	26  libsystem_pthread.dylib             0x0000000102952b90 _pthread_wqthread + 228
	27  libsystem_pthread.dylib             0x000000010295198c start_wqthread + 8

  1. Environment
    1. Platform: React-native
    2. SDK version: 8.11.6
    3. OS version:
    4. Xcode/Android Studio version: latest
    5. React Native version: 71
    6. SDK installation (CocoaPods + version or manual): Cocoapods
    7. How widespread is the issue. Percentage of devices affected: Literally happens on every device refresh
  2. Steps to reproduce, with a description of expected vs. actual behavior
    • open app on simulator, manually refresh

HilSny avatar Jun 25 '25 18:06 HilSny

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Jun 25 '25 18:06 RCGitBot

Seeing a similar error as well:

Last Exception Backtrace:
0   CoreFoundation                	       0x1804eaf78 __exceptionPreprocess + 160
1   libobjc.A.dylib               	       0x18009bf84 objc_exception_throw + 72
2   Foundation                    	       0x181037624 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
3   Padlet.debug.dylib            	       0x10a33e118 -[RCTEventEmitter sendEventWithName:body:] + 372 (RCTEventEmitter.m:45)
4   Padlet.debug.dylib            	       0x10a0e72bc __28-[RNPurchases setLogHandler]_block_invoke + 80 (RNPurchases.m:539)
5   Padlet.debug.dylib            	       0x109fd8bb0 thunk for @escaping @callee_unowned @convention(block) (@unowned NSDictionary) -> () + 60
6   Padlet.debug.dylib            	       0x109fd8ac8 closure #1 in static CommonFunctionality.setLogHander(onLogReceived:) + 332 (CommonFunctionality.swift:120)
7   Padlet.debug.dylib            	       0x10afc7a1c closure #1 in static Purchases.logHandler.setter + 152 (Purchases.swift:190)
8   Padlet.debug.dylib            	       0x10afe0504 partial apply for closure #1 in static Purchases.logHandler.setter + 36
9   Padlet.debug.dylib            	       0x10afc8214 closure #1 in static Purchases.verboseLogHandler.setter + 216 (Purchases.swift:216)
10  Padlet.debug.dylib            	       0x10afe0580 partial apply for closure #1 in static Purchases.verboseLogHandler.setter + 52
11  Padlet.debug.dylib            	       0x10ad7d264 static Logger.log(level:intent:message:fileName:functionName:line:) + 864 (Logger.swift:266)
12  Padlet.debug.dylib            	       0x10ad7ca7c static Logger.debug(_:fileName:functionName:line:) + 152 (Logger.swift:143)
13  Padlet.debug.dylib            	       0x10ad491b0 HTTPClient.handle(urlResponse:request:urlRequest:data:error:requestStartTime:) + 1236 (HTTPClient.swift:467)
14  Padlet.debug.dylib            	       0x10ad4c16c closure #1 in HTTPClient.start(request:) + 148 (HTTPClient.swift:557)
15  Padlet.debug.dylib            	       0x109ace8f0 thunk for @escaping @callee_guaranteed @Sendable (@guaranteed Data?, @guaranteed NSURLResponse?, @guaranteed Error?) -> () + 296
16  CFNetwork                     	       0x184c8a3bc __40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke + 500
17  CFNetwork                     	       0x184ca08ac __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke_2 + 152
18  libdispatch.dylib             	       0x1801b87a8 _dispatch_call_block_and_release + 24
19  libdispatch.dylib             	       0x1801d34b0 _dispatch_client_callout + 12
20  libdispatch.dylib             	       0x1801c1c28 _dispatch_lane_serial_drain + 984
21  libdispatch.dylib             	       0x1801c26e8 _dispatch_lane_invoke + 396
22  libdispatch.dylib             	       0x1801cd534 _dispatch_root_queue_drain_deferred_wlh + 288
23  libdispatch.dylib             	       0x1801ccc74 _dispatch_workloop_worker_thread + 692
24  libsystem_pthread.dylib       	       0x10220ebd0 _pthread_wqthread + 288
25  libsystem_pthread.dylib       	       0x10220d98c start_wqthread + 8

React Native 0.79.3, SDK version: 8.11.7, iOS 26 beta

thespacemanatee avatar Jun 26 '25 14:06 thespacemanatee

Hi, could you both make sure after upgrading to have cleaned and rebuilt your projects as well as cleared the CocoaPods cache and reinstalling the pods?

HaleyRevcat avatar Jun 30 '25 12:06 HaleyRevcat

Hi Haley,

That resolved it. So strange.

HilSny avatar Jun 30 '25 15:06 HilSny

Reopening this issue because I started experiencing it again. I believe to replicate you have to have the logs set to DEBUG.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: Purchases-LogHandlerEvent with body: {
    logLevel = DEBUG;
    message = "\U2139\Ufe0f PostPaywallEventsOperation: Started";
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNPurchases, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(0x19e0e321c 0x19b57dabc 0x19d3e1810 0x10a6e4838 0x10a511520 0x10a428e60 0x10a428d78 0x10aed67e4 0x10aef008c 0x10aed6fdc 0x10aef0108 0x10ac79550 0x10ac78d68 0x10ac8cdd4 0x10ac8dcc0 0x10ac8e034 0x19cc9f574 0x19cc9f7fc 0x19cc9fbb0 0x19cca11cc 0x1053a4ad0 0x1053ae064 0x105397f4c 0x1053cc888 0x1053a7f30 0x1053a88c8 0x2286c49d0 0x2286c4aac)
terminating due to uncaught exception of type NSException

I also got it another time by clicking open the paywall a couple times and then refreshing the sim.

terminating due to uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: Purchases-LogHandlerEvent with body: {
    logLevel = DEBUG;
    message = "\U2139\Ufe0f Looking up localization but found no strings";
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNPurchases, even though it's inherited from RCTEventEmitter.'
CoreSimulator 1010.15 - Device: iPhone 16 Pro (18B5867E-0EC7-4FF3-B0D6-A10A8B457D4E) - Runtime: iOS 18.4 (22E238) - DeviceType: iPhone 16 Pro

This is also logged before this occurs.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: Purchases-LogHandlerEvent with body: {
    logLevel = DEBUG;
    message = "\U2139\Ufe0f PostPaywallEventsOperation: Started";
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNPurchases, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(0x19e0e321c 0x19b57dabc 0x19d3e1810 0x10a6e4838 0x10a511520 0x10a428e60 0x10a428d78 0x10aed67e4 0x10aef008c 0x10aed6fdc 0x10aef0108 0x10ac79550 0x10ac78d68 0x10ac8cdd4 0x10ac8dcc0 0x10ac8e034 0x19cc9f574 0x19cc9f7fc 0x19cc9fbb0 0x19cca11cc 0x1053a4ad0 0x1053ae064 0x105397f4c 0x1053cc888 0x1053a7f30 0x1053a88c8 0x2286c49d0 0x2286c4aac)
terminating due to uncaught exception of type NSException

HilSny avatar Jul 08 '25 15:07 HilSny

Additionally, this was not occurring in 8.10 if that helps.

HilSny avatar Jul 08 '25 15:07 HilSny