Skip to content

🐛 EXC_BAD_ACCESS from closure in updateOfferingsCache #5812

@esamelson

Description

@esamelson

Describe the bug

I'm seeing this crash reported from a few devices in production after switching to RevenueCat recently. It looks like this code was touched recently, so it's possible it's fixed in a newer version of the SDK (I have 5.43.0 in production currently) but wanted to report anyway as I didn't see any other reports of this specific crash.

I'm using the React Native SDK and doing nothing with offerings other than calling Purchases.getOfferings.

Platform

iOS

SDK version

5.43.0

SDK integration method

CocoaPods

StoreKit version

StoreKit 2 (default on versions >=5.0.0)

OS version

iOS 18.0

Xcode version

16.1

Device and/or simulator

Device

Environment

Production

How widespread is the issue

Only specific devices (but persistent)

Debug logs

## Exception

### Exception
**Type:** EXC_BAD_ACCESS
**Value:** Exception 1, Code 1, Subcode 4 >
KERN_INVALID_ADDRESS at 0x4.

#### Stacktrace


 closure in Purchases.updateOfferingsCache in unknown file [Line null] (In app)
 swift::runJobInEstablishedExecutorContext in unknown file [Line null] (Not in app)

Steps to reproduce

(using React Native)
Purchases.configure();
...
await Purchases.getOfferings();

note: I have not reproduced this myself, calls are reconstructed from crash logs

Other information

Full information/diagnosis from Sentry

# EXC_BAD_ACCESS: Exception 1, Code 1, Subcode 4 >

## Issue Summary
EXC_BAD_ACCESS in Purchases.updateOfferingsCache
**What's wrong:** EXC_BAD_ACCESS (KERN_INVALID_ADDRESS) in **Purchases.updateOfferingsCache** closure, likely due to **null pointer dereference**.
**Possible cause:** The crash may stem from an **uninitialized or deallocated object** being accessed within the `updateOfferingsCache` closure, possibly related to network responses.

## Tags

- **device:** iPad13,18
- **device.class:** high
- **device.family:** iOS
- **environment:** release
- **event.environment:** native
- **event.origin:** ios
- **handled:** no
- **level:** fatal
- **mechanism:** mach
- **os:** iOS 18.0
- **os.build:** 22A5307f
- **os.name:** iOS
- **os.rooted:** no

## Exception

### Exception 1
**Type:** EXC_BAD_ACCESS
**Value:** Exception 1, Code 1, Subcode 4 >
KERN_INVALID_ADDRESS at 0x4.

#### Stacktrace


 closure in Purchases.updateOfferingsCache in unknown file [Line null] (In app)
 swift::runJobInEstablishedExecutorContext in unknown file [Line null] (Not in app)

Additional context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions