I had an initial functioning setup to get offerings and make a purchase. It worked : I could make a test purchase.
The code was in a ‘shop’ page, and I decided to move the RevenueCat initialisation to main.dart as initial entry point. But maybe this wrong because it screwed everything up, and the app crashed on loading (error below). So I put it back to what it was.
The app now loads and all screens function EXCEPT I am now getting the same error when I open the shop page. Even though it was working before.
*** Assertion failure in +[RCPurchases sharedPurchases](), RCPurchases.m:160
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There is no singleton instance. Make sure you configure Purchases before trying to get the default instance. More info here: https://errors.rev.cat/configuring-sdk'
*** First throw call stack:
(0x183586754 0x19804d7a8 0x1834883f8 0x1848afa6c 0x1009762f4 0x1009f2d34 0x100cb7bc0 0x100cb5b04 0x10109ea60 0x100dafd7c 0x1010b9070 0x1010531d4 0x1010559fc 0x18350122c 0x183500e28 0x183500278 0x1834fa02c 0x1834f9360 0x19ab37734 0x185f74584 0x185f79df4 0x100906e24 0x1831b5cf8)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001b169d334 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1b169d334 <+8>: b.lo 0x1b169d354 ; <+40>
0x1b169d338 <+12>: pacibsp
0x1b169d33c <+16>: stp x29, x30, [sp, #-0x10]!
0x1b169d340 <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Error says I should configure Purchases …. but I did !
static const revcatapiKey = 'xxxxxxxxxxxxxxxxxxxxxxxx';
await Purchases.setDebugLogsEnabled(true);
await Purchases.setup(revcatapiKey,
appUserId: appUserId, observerMode: false);
I did `flutter clean` and `flutter pub get`. Same situation : app builds and loads and crashes on opening shop screen.
I don’t understand. App is now in same state as it was before when working.
Any debug or reset suggestions? Help!