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

[BUG] Superwall.shared.reset() is crashed #228

Closed
2 of 3 tasks
jwthanh opened this issue Aug 1, 2024 · 9 comments
Closed
2 of 3 tasks

[BUG] Superwall.shared.reset() is crashed #228

jwthanh opened this issue Aug 1, 2024 · 9 comments

Comments

@jwthanh
Copy link

jwthanh commented Aug 1, 2024

New issue checklist

  • I have reviewed the README and documentation
  • I have searched existing issues and this is not a duplicate
  • I have attempted to reproduce the issue and include an example project.

General information

  • Superwall version: 3.7.0
  • iOS version(s): 17.5
  • CocoaPods/Carthage version (if applicable): 1.15.2
  • Xcode version: 15.4
  • Devices/Simulators affected: Simulator IPhone 15 Pro Max
  • Reproducible in the demo project? (Yes/No): No
  • Related issues: N/A

Describe the bug

I am trying to call Superwall.shared.reset() when a user is logged out. Then it crashes for both cases using the main thread or background thread.

NSFetchRequest could not locate an NSEntityDescription for entity name 'EventData'

Steps to reproduce

  • Set a userId when a user is logged in. Superwall.shared.identify(userId: "\(userId)", options: .init(restorePaywallAssignments: true))
  • Superwall.shared.reset() when a user is logged out.

Other Information

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSFetchRequest could not locate an NSEntityDescription for entity name 'EventData''
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
	2   CoreData                            0x000000018644c794 -[NSFetchRequest(_NSInternalMethods) _incrementInUseCounter] + 0
	3   CoreData                            0x000000018646d8b8 -[NSManagedObjectContext executeRequest:error:] + 164
@yusuftor
Copy link
Collaborator

yusuftor commented Aug 1, 2024

Hi, I'm unable to reproduce this. Can you share the full stack trace? I'm wondering if this is a cocoapods thing, I'll try that now.

@jwthanh
Copy link
Author

jwthanh commented Aug 1, 2024

@yusuftor

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSFetchRequest could not locate an NSEntityDescription for entity name 'EventData''
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
	2   CoreData                            0x000000018644c794 -[NSFetchRequest(_NSInternalMethods) _incrementInUseCounter] + 0
	3   CoreData                            0x000000018646d8b8 -[NSManagedObjectContext executeRequest:error:] + 164
	4   ABC                            0x0000000103586c1c $sSo22NSManagedObjectContextC12SuperwallKitE22executeAndMergeChanges5usingySo20NSBatchDeleteRequestC_tKF + 144
	5   ABC                            0x00000001038378bc $s12SuperwallKit15CoreDataManagerC17deleteAllEntities10completionyyycSg_tFyyXEfU_ + 104
	6   ABC                            0x000000010375fc70 $sIg_Ieg_TR + 20
	7   ABC                            0x000000010375fcc8 $sIeg_IyB_TR + 24
	8   CoreData                            0x00000001864746d4 developerSubmittedBlockToNSManagedObjectContextPerform + 156
	9   libdispatch.dylib                   0x0000000109e5173c _dispatch_client_callout + 16
	10  libdispatch.dylib                   0x0000000109e6248c _dispatch_lane_barrier_sync_invoke_and_complete + 144
	11  CoreData                            0x00000001864745e0 -[NSManagedObjectContext performBlockAndWait:] + 260
	12  ABC                            0x000000010383768c $s12SuperwallKit15CoreDataManagerC17deleteAllEntities10completionyyycSg_tF + 720
	13  ABC                            0x0000000103844c14 $s12SuperwallKit7StorageC5resetyyF + 180
	14  ABC                            0x0000000103913f4c $s12SuperwallKit0A0C5reset14duringIdentifyySb_tF + 548
	15  ABC                            0x0000000103913d1c $s12SuperwallKit0A0C5resetyyF + 36
	16  ABC                            0x00000001027fc0dc $s11ABCApp0B8DelegateC19handleRelatedLogout33_C3110E7099013F1299971B70FF042347LLyyF + 264
	17  ABC                            0x00000001027fbfa8 $s11ABCApp0B8DelegateC15handleAuthState33_C3110E7099013F1299971B70FF042347LLyyFy0A6Engine0eF0OcfU_ + 1136
	18  ABC                            0x000000010439efa0 $s7RxSwift14ObservableTypePAAE9subscribe6onNext0F5Error0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_ys0H0_pcSgyycSgAOtFyAA5EventOyAKGcfU_ + 580
	19  ABC                            0x000000010439fc60 $s7RxSwift14ObservableTypePAAE9subscribe6onNext0F5Error0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_ys0H0_pcSgyycSgAOtFyAA5EventOyAKGcfU_TA + 84
	20  ABC                            0x00000001043a07b8 $s7RxSwift17AnonymousObserverC6onCoreyyAA5EventOyxGF + 88
	21  ABC                            0x00000001043a0cdc $s7RxSwift12ObserverBaseC2onyyAA5EventOyxGF + 264
	22  ABC                            0x00000001043a0f80 $s7RxSwift12ObserverBaseCyxGAA0C4TypeA2aEP2onyyAA5EventOy7ElementQzGFTW + 28
	23  ABC                            0x00000001043bdd80 $s7RxSwift15BehaviorSubjectC22synchronized_subscribeyAA10Disposable_pqd__7ElementQyd__RszAA12ObserverTypeRd__lFyAA5EventOyxGcqd__cfu_yAKcfu0_ + 76
	24  ABC                            0x0000000104355a40 $s7RxSwift5EventOyxGIegn_ADytIegnr_7ElementQyd__RszAA12ObserverTypeRd__r__lTR + 20
	25  ABC                            0x00000001042d9290 $s7RxSwift5EventOyxGytIegnr_ADIegn_lTR + 20
	26  ABC                            0x00000001042d9034 $s7RxSwift8dispatchyyAA3BagVyyAA5EventOyxGcG_AGtlF + 960
	27  ABC                            0x00000001043bcc10 $s7RxSwift15BehaviorSubjectC2onyyAA5EventOyxGF + 136
	28  ABC                            0x00000001043be758 $s7RxSwift15BehaviorSubjectCyxGAA12ObserverTypeA2aEP2onyyAA5EventOy7ElementQzGFTW + 20
	29  ABC                            0x00000001043a42b8 $s7RxSwift12ObserverTypePAAE6onNextyy7ElementQzF + 288
	30  ABC                            0x00000001042bebd0 $s7RxRelay08BehaviorB0C6acceptyyxF + 132
	31  ABC                            0x00000001039531f8 $s14ABCEngine11AppHolisticC6logoutyyF + 836
	32  ABC                            0x00000001039587f0 $s14ABCEngine11AppHolisticCAA0D0A2aDP6logoutyyFTW + 44
	33  ABC                            0x000000010298a754 $s7Account0A9ViewModelC6logoutyyF + 84
	34  ABC                            0x0000000102958128 $s7Account0A14ViewControllerC4bindyyFyyt_tcfU2_ + 192
	35  ABC                            0x000000010280a5a0 $sIeg_ytIegn_TR + 20
	36  ABC                            0x000000010439efa0 $s7RxSwift14ObservableTypePAAE9subscribe6onNext0F5Error0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_ys0H0_pcSgyycSgAOtFyAA5EventOyAKGcfU_ + 580
	37  ABC                            0x000000010439fc60 $s7RxSwift14ObservableTypePAAE9subscribe6onNext0F5Error0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_ys0H0_pcSgyycSgAOtFyAA5EventOyAKGcfU_TA + 84
	38  ABC                            0x00000001043a07b8 $s7RxSwift17AnonymousObserverC6onCoreyyAA5EventOyxGF + 88
	39  ABC                            0x00000001043a0cdc $s7RxSwift12ObserverBaseC2onyyAA5EventOyxGF + 264
	40  ABC                            0x00000001043a0f80 $s7RxSwift12ObserverBaseCyxGAA0C4TypeA2aEP2onyyAA5EventOy7ElementQzGFTW + 28
	41  ABC                            0x000000010435a48c $s7RxSwift4SinkC9forwardOnyyAA5EventOy7ElementQzGF + 316
	42  ABC                            0x0000000104360c9c $s7RxSwift15SubscribeOnSink33_B44C3DD7F62EF81799E6347E59A266A2LLC2onyyAA5EventOy7ElementQzGF + 204
	43  ABC                            0x0000000104361560 $s7RxSwift15SubscribeOnSink33_B44C3DD7F62EF81799E6347E59A266A2LLCyxq_GAA12ObserverTypeA2aFP2onyyAA5EventOy7ElementQzGFTW + 20
	44  ABC                            0x000000010435a48c $s7RxSwift4SinkC9forwardOnyyAA5EventOy7ElementQzGF + 316
	45  ABC                            0x000000010432d5d8 $s7RxSwift7MapSink33_5428EFA9A9B0C0340021B871D2E5AC01LLC2onyyAA5EventOyxGF + 668
	46  ABC                            0x000000010432dae8 $s7RxSwift7MapSink33_5428EFA9A9B0C0340021B871D2E5AC01LLCyxq_GAA12ObserverTypeA2aFP2onyyAA5EventOy7ElementQzGFTW + 20
	47  ABC                            0x000000010435a48c $s7RxSwift4SinkC9forwardOnyyAA5EventOy7ElementQzGF + 316
	48  ABC                            0x0000000104360c9c $s7RxSwift15SubscribeOnSink33_B44C3DD7F62EF81799E6347E59A266A2LLC2onyyAA5EventOy7ElementQzGF + 204
	49  ABC                            0x0000000104361560 $s7RxSwift15SubscribeOnSink33_B44C3DD7F62EF81799E6347E59A266A2LLCyxq_GAA12ObserverTypeA2aFP2onyyAA5EventOy7ElementQzGFTW + 20
	50  ABC                            0x000000010435a48c $s7RxSwift4SinkC9forwardOnyyAA5EventOy7ElementQzGF + 316
	51  ABC                            0x000000010436bec4 $s7RxSwift13TakeUntilSink33_BE40EAA6FB8248E7BF8F5D6AEBCC5639LLC15synchronized_onyyAA5EventOy7ElementQy_GF + 272
	52  ABC                            0x000000010436c578 $s7RxSwift13TakeUntilSink33_BE40EAA6FB8248E7BF8F5D6AEBCC5639LLCyxq_GAA18SynchronizedOnTypeA2aFP15synchronized_onyyAA5EventOy7ElementQzGFTW + 12
	53  ABC                            0x00000001042cc7c4 $s7RxSwift18SynchronizedOnTypePAAE012synchronizedD0yyAA5EventOy7ElementQzGF + 152
	54  ABC                            0x000000010436bda8 $s7RxSwift13TakeUntilSink33_BE40EAA6FB8248E7BF8F5D6AEBCC5639LLC2onyyAA5EventOy7ElementQy_GF + 136
	55  ABC                            0x000000010436c560 $s7RxSwift13TakeUntilSink33_BE40EAA6FB8248E7BF8F5D6AEBCC5639LLCyxq_GAA12ObserverTypeA2aFP2onyyAA5EventOy7ElementQzGFTW + 20
	56  ABC                            0x000000010435a48c $s7RxSwift4SinkC9forwardOnyyAA5EventOy7ElementQzGF + 316
	57  ABC                            0x0000000104311538 $s7RxSwift23AnonymousObservableSink33_95EBF5692819D58425EC2DD0512D115ALLC2onyyAA5EventOy7ElementQzGF + 400
	58  ABC                            0x00000001043118e4 $s7RxSwift23AnonymousObservableSink33_95EBF569281
libc++abi: terminating due to uncaught exception of type NSException

@yusuftor
Copy link
Collaborator

yusuftor commented Aug 1, 2024

Thanks! Confirmed this is not a cocoapods thing. Is this happening every time for you? We haven't changed anything to do with Core Data in the latest version. And do you use Core Data within your own app?

@jwthanh
Copy link
Author

jwthanh commented Aug 1, 2024

@yusuftor This is happening every time, even in the 3.6.6 version. We don't use Core Data in our app. Does the screenshot below help us have more information?
image

@yusuftor
Copy link
Collaborator

yusuftor commented Aug 1, 2024

Hmm. Can you try the following:

  1. Uninstalling and reinstalling SuperwallKit
  2. Cleaning your build folder
  3. If it still doesn't work, can you show me your resources folder for the SuperwallKit pod and click on SuperwallKit_Model and show send me a screenshot of what you see there?
Screenshot 2024-08-01 at 11 52 50

@jwthanh
Copy link
Author

jwthanh commented Aug 1, 2024

Thank you, @yusuftor. It is missing SuperwallKit_Model in the Resources somehow. Let me try to find out the reason and post it here. It is a bit different in our project because it uses Bazel build.

@yusuftor
Copy link
Collaborator

yusuftor commented Aug 1, 2024

Okay, you need to make sure all resources are added. I'm not familiar with Bazel but it looks like they're not being added by default with Cocoapods

@yusuftor
Copy link
Collaborator

yusuftor commented Aug 2, 2024

I'm going to close this issue now but please leave a comment when this is fixed from the BazelPod side.

@yusuftor yusuftor closed this as completed Aug 2, 2024
@jwthanh
Copy link
Author

jwthanh commented Aug 2, 2024

@yusuftor This issue is fixed and released in the https://github.com/sergeykhliustin/BazelPods/releases/tag/1.12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants