RevenueCat / RevenueCat/react-native-purchases
[iOS] JSON value '<null>' of type NSNull cannot be converted to NSString
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 117
- Avg merge
- 14h 40m
- Merged PRs (30d)
- 40
Description
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
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...
- Environment
- Platform: iOS
- SDK version:
- OS version: 26.5
- Xcode/Android Studio version: 26.6
- React Native version: 0.87.1
- SDK installation (CocoaPods + version or manual): 10.9.0
- Error on all iOS devices
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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