fix(ios): declare PLYUserAttributeDelegate conformance on PurchaselyRN - #297
Merged
Merged
Conversation
PurchaselyRN.m line 581 calls `[Purchasely setUserAttributeDelegate: self]`, but the header did not declare the protocol. The compiler reported: warning: sending 'PurchaselyRN *const __strong' to parameter of incompatible type 'id<PLYUserAttributeDelegate> _Nonnull' The class implements two of the three delegate methods and bridges them to the USER_ATTRIBUTE_SET_LISTENER and USER_ATTRIBUTE_REMOVED_LISTENER events. Without the declaration the compiler checks nothing on this contract. All three protocol methods are `@objc optional` in the pinned pod (Purchasely 6.0.0), so the declaration adds no required method and changes no behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
| Filename | Overview |
|---|---|
| packages/purchasely/ios/PurchaselyRN.h | Adds the missing PLYUserAttributeDelegate conformance to the native iOS bridge interface. |
Reviews (1): Last reviewed commit: "fix(ios): declare PLYUserAttributeDelega..." | Re-trigger Greptile
The e2e-ios and e2e-android groups were global, so a run on one branch cancelled the run on every other branch. PR #297 went red for that reason, not for a test failure. Mirror the ci.yml pattern: key the group by ref and cancel superseded pull_request runs only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
macminisupport
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The warning
packages/purchasely/ios/PurchaselyRN.mline 581 gives the native SDK thebridge module as the user attribute delegate:
packages/purchasely/ios/PurchaselyRN.hline 12 does not declarePLYUserAttributeDelegateon the class. The compiler reports:Why it matters
The warning is a type safety hole, not only untidy output.
The compiler cannot verify the delegate contract on a class that does not
declare the protocol.
PurchaselyRNimplements two delegate methods:onUserAttributeSetWithKey:type:value:source:processingLegalBasis:andonUserAttributeRemovedWithKey:source:. Both bridge to theUSER_ATTRIBUTE_SET_LISTENERandUSER_ATTRIBUTE_REMOVED_LISTENERevents inJavaScript.
Without the declaration the compiler gives no check at all on this contract.
The call site accepts any object, and a change in the protocol stays
invisible until a runtime test exercises the callback. The JavaScript
listener then does not receive events any more, and nothing in the build
reports it.
The declaration restores three compile-time checks:
-Wprotocoland the argument type check bothapply, so the warning disappears for the right reason.
warning. The compiler compares each implemented method against the
protocol declaration.
-Wprotocolwarning on this class.A pure rename in the native SDK stays silent, because all current methods
are optional. The declaration still makes the class role explicit, and it
gives the compiler the contract to check the two points above.
Why the fix is safe
All three methods of
PLYUserAttributeDelegateare@objc optional. Thegenerated Objective-C header in the pinned pod (
Purchasely 6.0.0,Purchasely.framework/Headers/Purchasely-Swift.hline 1345) shows:The declaration adds no required method. The two selectors that the bridge
implements match the protocol exactly. The behaviour does not change.
Build evidence
Command, on the CocoaPods workspace:
Before the fix:
After the fix:
The XCTest bundle
react-native-purchasely-Unit-Testsalso passes on abooted simulator.
Scope
The change is one line in one header file. The pull request touches no other
file. It changes no behaviour on iOS, and it touches nothing on Android.
The header has never declared this protocol. The delegate call site arrived
in 5.0.4 (#173). The warning is confirmed against the pinned pod of 6.0.0,
so it ships in 6.0.0. Earlier releases are not checked against their own pod
pin. The warning is not related to the 6.1.0 work in #293.
Out of scope
The same build prints unrelated
-Wdeprecated-declarationswarnings, forexample on
setThemeMode:. This pull request leaves them unchanged.