RevenueCat / RevenueCat/react-native-purchases

[iOS] JSON value '<null>' of type NSNull cannot be converted to NSString

Open
#1,938 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
117
Avg merge
14h 40m
Merged PRs (30d)
40

Description

Describe the bug
After Purchases.configure({ apiKey: REVENUECAT_API_KEY }); is called, Xcode console logs: JSON value '<null>' of type NSNull cannot be converted to NSString. Upon refreshing the simulator the error logs again. If I remove configure, the log is gone.

Update: I found that this error is triggered when appUserID is absent. https://github.com/RevenueCat/react-native-purchases/blob/85bba1e2c71cd5f05e798960fffa8d2ebfcaaf79/src/purchases.ts#L615
Not explicitly setting it to null (when absent) fixes it for me, so leaving it undefined.
https://github.com/RevenueCat/react-native-purchases/blob/85bba1e2c71cd5f05e798960fffa8d2ebfcaaf79/src/purchases.ts#L525

Now found that it was mentioned here that this warning can't be removed: https://github.com/RevenueCat/react-native-purchases/pull/1196
What is the downside of passing it as undefined to native instead of null? Which removes the warning...

  1. Environment
    1. Platform: iOS
    2. SDK version:
    3. OS version: 26.5
    4. Xcode/Android Studio version: 26.6
    5. React Native version: 0.87.1
    6. SDK installation (CocoaPods + version or manual): 10.9.0
    7. Error on all iOS devices

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/purchases.ts at the appUserID handling referenced around lines 525 and 615, then review pull request #1196 for the native-bridge context. Reproduce the warning by calling Purchases.configure without appUserID on iOS. Done means preserving configuration behavior while avoiding the NSNull-to-NSString warning when appUserID is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.