Skip to content
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

Swift module with 0.6.0-rc #1746

Closed
nicinabox opened this issue Jun 25, 2015 · 2 comments
Closed

Swift module with 0.6.0-rc #1746

nicinabox opened this issue Jun 25, 2015 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@nicinabox
Copy link
Contributor

I'm getting the following error with the snippet below. As far as I can tell this is how the docs say wire a Swift module. What am I missing?

Unknown argument type 'NSObject' in method -[SocketIO emit:items:]. Extend RCTConvert to support this type.

# SocketBridge.m
#import "RCTBridgeModule.h"

@interface RCT_EXTERN_MODULE(SocketIO, NSObject)

RCT_EXTERN_METHOD(emit:(NSString*)event items:(NSObject*)items)

@end
``
@nicklockwood
Copy link
Contributor

Sorry about that - I forgot to add NSObject as a supported RCTConvert type.

It's generally better to be specific about the type, so use NSArray, NSDictionary, or whatever the actual type is. But if you aren't sure, or it's a mixed type (i.e. could be several different types) then use id, like this:

RCT_EXTERN_METHOD(emit:(NSString*)event items:(id)items)

@nicinabox
Copy link
Contributor Author

💥 items:(id)items does the trick. Thanks for the tip @nicklockwood!

nicinabox added a commit to nicinabox/react-native-swift-socketio that referenced this issue Jun 26, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jun 26, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants