-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate declaration of method 'resolver:rejecter:'
- Promises & Native Modules - RCT_REMAP_METHOD
#9070
Comments
Name the methods get_data_resolver:rejecter: and send_count_resolver:rejecter:. The remap macro only sets up an alias to the method name you give it. |
I tried that twice. Xcode gave me a C99 error. After I quit Xcode and restarted my computer your solution works. 🌵 Either way, is is not really a nice solution long term. It works but, I should be able to use ANY name I want within that method as with parameters in any and every other method. that's how I feel intuitively. thinking that is maybe nonsense because I'm unfamiliar with macros and how they work under the hood. More of a Swifter... thanks for explaining 💯 👍 ❤️ |
You can use any name you want if you follow the rules of Objective-C. The macro defines an Objective-C method with the exact name that you give it. |
What I mean is - if the exported method name is different from some other exported method name it should not matter whether the parameters are named same or not. In obj-c it won't complain if you have same parameter names in 2 distinct methods. But clearly that's not the case here 😅 Need to learn about macros... If you know of a resource that explains macros in a simple way I'd be delighted to read it. 🏆 as always, thanks for finding the time to read and reply 💯 |
I think you're misreading the macro. It's RCT_REMAP_METHOD(alias, method), not RCT_REMAP_METHOD(alias, parameters). |
@ide thanks |
Summary: The current docs (iOS) for promises make use of the `RCT_REMAP_METHOD` macro but it's not clear about the proper usage for the macro. Specifically, it points to a selector of `resolver:rejector:` and makes it seem like `findEvents` is assumed as both the alias and method name. This has led to some confusion (#9070) on how to use `RCT_REMAP_METHOD`. No tests needed since this is just a small docs update. Closes #13302 Differential Revision: D4831755 Pulled By: javache fbshipit-source-id: e842c16ade27088eafdac7509373cdf7780f9ece
Summary: The current docs (iOS) for promises make use of the `RCT_REMAP_METHOD` macro but it's not clear about the proper usage for the macro. Specifically, it points to a selector of `resolver:rejector:` and makes it seem like `findEvents` is assumed as both the alias and method name. This has led to some confusion (facebook#9070) on how to use `RCT_REMAP_METHOD`. No tests needed since this is just a small docs update. Closes facebook#13302 Differential Revision: D4831755 Pulled By: javache fbshipit-source-id: e842c16ade27088eafdac7509373cdf7780f9ece
Error message:
Duplicate declaration of method 'resolver:rejecter:'
Can I export only one method which uses promises?
Shouldn't the scope be limited to exported method?
if not
How can I reuse the method then?
thanks
The text was updated successfully, but these errors were encountered: