purchases-ios: Fatal Exception in `RCPurchases.m`

We’re seeing a Fatal Exception in our latest app version.

Details

  • iOS v13.3
  • App in foreground state
  • Crashlytics assumes device is jailbroken
  • SDK revenuecat/purchases-ios v3.2.2, installed through Carthage

Stack trace

Fatal Exception: NSInvalidArgumentException
*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil

-[RCPurchases purchaseProduct:withPayment:withPresentedOfferingIdentifier:completion:]

0  CoreFoundation                 0x19b5a096c __exceptionPreprocess
1  libobjc.A.dylib                0x19b2b9028 objc_exception_throw
2  CoreFoundation                 0x19b5f9500 -[__NSCFString characterAtIndex:].cold.1
3  CoreFoundation                 0x19b6035a0 -[__NSDictionaryM setObject:forKeyedSubscript:].cold.2
4  CoreFoundation                 0x19b47b190 -[__NSDictionaryM setObject:forKeyedSubscript:]
5  Purchases                      0x1054aa4b0 -[RCPurchases purchaseProduct:withPayment:withPresentedOfferingIdentifier:completion:] + 558 (RCPurchases.m:558)
6  Purchases                      0x1054a9f08 -[RCPurchases purchasePackage:withCompletionBlock:] + 485 (RCPurchases.m:485)
7  AppName                        0x104f2d738 closure #1 in RCPurchases.purchase(_:) + 134 (PurchasesExtension.swift:134)
8  AppName                        0x105055ee8 partial apply for thunk for @escaping @callee_guaranteed (@guaranteed @escaping @callee_guaranteed (@guaranteed SingleEvent<RCOfferings>) -> ()) -> (@out Disposable)
9  RxSwift                        0x1061c99f4 partial apply for closure #1 in static PrimitiveSequenceType<>.create(subscribe:) + 39 (Single.swift:39)
10 RxSwift                        0x10619946c AnonymousObservable.run<A>(_:cancel:) + 60 (Create.swift:60)
11 RxSwift                        0x1061a6f64 Producer.subscribe<A>(_:) + 18 (Producer.swift:18)
...

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

The PR is already merged, we’ll mst likely make a build with it tomorrow

I’m having a similar issue. We have an existing manual implementation for handling in-app purchases. We integrated RevenueCat in observer mode with the intention of sending events straight to Mixpanel. The app occasionally crashes at launch, and also occasionally when making a purchase. On 3.2.2 via cocoapods.

Error is - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'

Screen Shot 2020-04-30 at 2 18 57 PM

Logs leading up to the crash. This is when I actively make a purchase on the device:

2020-04-30 14:01:52.162478-0400 Lucid[2651:716081] [] tcp_input [C41.1:3] flags=[R] seq=488382302, ack=0, win=0 state=CLOSED rcv_nxt=488382302, snd_una=2781351864
2020-04-30 14:02:36.316952-0400 Lucid[2651:715531] Reachability Flag Status: -R ------- networkStatusForFlags
2020-04-30 14:02:36.341251-0400 Lucid[2651:715531] [Purchases] - DEBUG: PaymentQueue updatedTransaction: com.polywise.subscriptions.yearly2 (null) ((null)) (null) - 0
didUpdateTransactionState: purchasing
didUpdateTransactionState: purchasing
2020-04-30 14:02:37.294697-0400 Lucid[2651:715690] [] tcp_input [C42.1:3] flags=[R] seq=2270347801, ack=0, win=0 state=CLOSED rcv_nxt=2270347801, snd_una=1627576718
2020-04-30 14:02:37.299071-0400 Lucid[2651:715690] [] tcp_input [C42.1:3] flags=[R] seq=2270347801, ack=0, win=0 state=CLOSED rcv_nxt=2270347801, snd_una=1627576718
2020-04-30 14:02:37.630255-0400 Lucid[2651:715531] [Purchases] - INFO: Subscriber attributes synced successfully
2020-04-30 14:02:37.781674-0400 Lucid[2651:716157] [] tcp_input [C43.1:3] flags=[R] seq=4284267699, ack=0, win=0 state=CLOSED rcv_nxt=4284267699, snd_una=1940899561
2020-04-30 14:02:37.785288-0400 Lucid[2651:715690] [] tcp_input [C43.1:3] flags=[R] seq=4284267699, ack=0, win=0 state=CLOSED rcv_nxt=4284267699, snd_una=1940899561
2020-04-30 14:02:44.969705-0400 Lucid[2651:715531] [Purchases] - INFO: Subscriber attributes synced successfully
2020-04-30 14:02:44.970351-0400 Lucid[2651:715531] [Purchases] - DEBUG: applicationDidBecomeActive
2020-04-30 14:02:45.394032-0400 Lucid[2651:716333] [] tcp_output [C46.1:3] flags=[R.] seq=3126190447, ack=2828646762, win=1023 state=CLOSED rcv_nxt=2828646762, snd_una=3126190423
2020-04-30 14:02:45.444060-0400 Lucid[2651:716333] [] tcp_input [C46.1:3] flags=[R] seq=2828646722, ack=0, win=0 state=CLOSED rcv_nxt=2828646762, snd_una=3126190423
2020-04-30 14:02:45.454057-0400 Lucid[2651:716333] [] tcp_input [C46.1:3] flags=[R] seq=2828646761, ack=0, win=0 state=CLOSED rcv_nxt=2828646762, snd_una=3126190423
2020-04-30 14:02:45.528293-0400 Lucid[2651:716157] [] tcp_input [C47.1:3] flags=[R] seq=459752767, ack=0, win=0 state=CLOSED rcv_nxt=459752767, snd_una=20142008
2020-04-30 14:02:45.529474-0400 Lucid[2651:716157] [] tcp_input [C47.1:3] flags=[R] seq=459752767, ack=0, win=0 state=CLOSED rcv_nxt=459752767, snd_una=20142008
2020-04-30 14:02:48.266180-0400 Lucid[2651:715531] [Purchases] - INFO: Subscriber attributes synced successfully
2020-04-30 14:02:52.845405-0400 Lucid[2651:715531] [Purchases] - INFO: Subscriber attributes synced successfully
2020-04-30 14:02:52.845739-0400 Lucid[2651:715531] [Purchases] - DEBUG: applicationDidBecomeActive
2020-04-30 14:02:55.545472-0400 Lucid[2651:715531] [Purchases] - INFO: Subscriber attributes synced successfully
2020-04-30 14:02:55.595547-0400 Lucid[2651:715531] [Purchases] - DEBUG: PaymentQueue updatedTransaction: com.polywise.subscriptions.yearly2 1000000659033216 ((null)) 1000000586775669 - 1
2020-04-30 14:02:55.595979-0400 Lucid[2651:715531] [Purchases] - DEBUG: Loaded receipt from file:///private/var/mobile/Containers/Data/Application/5AB7E939-F810-4D74-8FD8-670B3C07613E/StoreKit/sandboxReceipt
2020-04-30 14:02:55.596407-0400 Lucid[2651:715531] [Purchases] - DEBUG: Requesting products with identifiers: {(
    "com.polywise.subscriptions.yearly2"
)}
didUpdateTransactionState: purchased
2020-04-30 14:02:55.754784-0400 Lucid[2651:716420] [Purchases] - DEBUG: Products request finished
2020-04-30 14:02:55.756124-0400 Lucid[2651:716420] [Purchases] - DEBUG: Valid Products:
2020-04-30 14:02:55.757325-0400 Lucid[2651:716420] [Purchases] - DEBUG: com.polywise.subscriptions.yearly2 - <SKProduct: 0x13947fb30>
2020-04-30 14:02:55.758270-0400 Lucid[2651:716420] [Purchases] - DEBUG: Invalid Product Identifiers - (
)
2020-04-30 14:02:55.759035-0400 Lucid[2651:716420] [Purchases] - DEBUG: 1 completion handlers waiting on products
didUpdateTransactionState: purchased
2020-04-30 14:02:56.546940-0400 Lucid[2651:715531] Reachability Flag Status: -R ------- networkStatusForFlags
2020-04-30 14:03:09.091680-0400 Lucid[2651:715531] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(0x18f892a48 0x18f5b9fa4 0x18f8e8360 0x18f8f16b4 0x18f77f73c 0x18f7715d0 0x1034f7c10 0x103519234 0x1035111ec 0x105ddd7fc 0x105ddebd8 0x105decc34 0x18f8105e4 0x18f80b5d8 0x18f80aadc 0x1997ab328 0x19391863c 0x100d11630 0x18f694360)
libc++abi.dylib: terminating with uncaught exception of type NSException

@aboedo does this seem related?