Skip to content

iOS: complete the FlutterResult in inbox listener registration, fix double reply in setAttribute - #10

Open
fa0311 wants to merge 1 commit into
salesforce-marketingcloud:mainfrom
fa0311:fix/ios-method-channel-contract
Open

iOS: complete the FlutterResult in inbox listener registration, fix double reply in setAttribute#10
fa0311 wants to merge 1 commit into
salesforce-marketingcloud:mainfrom
fa0311:fix/ios-method-channel-contract

Conversation

@fa0311

@fa0311 fa0311 commented Jul 19, 2026

Copy link
Copy Markdown

Two small method-channel contract issues in SfmcPlugin.m:

registerInboxResponseListener / unregisterInboxResponseListener never invoke the result block, so on iOS await SFMCSdk.registerInboxResponseListener(...) simply never resolves. Easy to hit if you await it during app init - there's no error, the code after the await just never runs. Android replies with result.success(null).

setAttribute has the opposite problem: it replies inside the requestPushSdk completion and then again synchronously right after.

Three-line fix, following the pattern of the other handler branches.

…n and setAttribute

The registerInboxResponseListener and unregisterInboxResponseListener
branches of handleMethodCall never invoked the FlutterResult block, so
the Dart Future returned by these method-channel calls never completed
on iOS and any await on them hung forever. They now reply with
result(nil) after registering or unregistering the listeners, matching
the pattern used by every other branch.

The setAttribute branch invoked the FlutterResult twice: once
synchronously in handleMethodCall and again inside the requestPushSdk
completion block of setAttributeWithKey:value:result:. Replying more
than once on the same result violates the method-channel contract. The
redundant synchronous reply is removed so the call replies exactly
once, from the success path after the attribute is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants