kirkness / react-native-swift-socketio

A react native wrapper for socket.io-client-swift
109 stars 14 forks source link

Cannot read property 'initialise' of undefined #1

Closed nicinabox closed 9 years ago

nicinabox commented 9 years ago

It seems the initial SocketIO require returns undefined causing the initialization to fail down the line.

I checked NativeModules and it doesn't appear to have a SocketIO key. Any ideas?

Using React Native 0.4.4.

kirkness commented 9 years ago

Hi Nic, Have you followed the install at the bottom of the readme? This would be the case if you don't have the files copied to your build phases + set the Objc bridging header. Hope this helps!

nicinabox commented 9 years ago

Huh okay. I did have trouble with one of the steps.

Search for Objective-C Bridging Header

This row doesn't exist (maybe that's expected?). I tried adding it as a User Defined setting, but had to name it "Objective_C_Bridging_Header". Perhaps that's the issue?

kirkness commented 9 years ago

Ok - yes it should be there, if you go click your project on the left, select your project name from the 'targets', then build settings, hopefully it should be there?

screen shot 2015-05-18 at 16 52 48

nicinabox commented 9 years ago

I got nothin.

screen shot 2015-05-18 at 10 57 05 am

nicinabox commented 9 years ago

If I add a new blank swift file it seems to trigger that, but not when I add the files to the project.

kirkness commented 9 years ago

Oh ok - and what if you add the RNSwiftSocketIO group to your CuraMessenger group as opposed to libraries?

nicinabox commented 9 years ago

Same thing.

kirkness commented 9 years ago

Ok as in its not adding the field when you move them to your project? Also worth double checking all the RNSwiftSocketIO files are in your Compile Sources

nicinabox commented 9 years ago

Correct.

There was nothing in Compile Sources aside from AppDelegate.m and main.m, so attempting to add the directory there gives this:

screen shot 2015-05-18 at 11 13 12 am

It doesn't appear to have any children, but lets me add the directory anyway. Object-C Bridging Header still not available though.

kirkness commented 9 years ago

Interesting - I think it may be worth removing the files and running through the install again. I think that the problem will have stemmed from originally adding the group to libraries rather than the main package. Let me know if you have any luck.

nicinabox commented 9 years ago

Just tried with a newly generated project (react-native init ...) and see the same thing. Seems like it never recognizes the swift files.

kirkness commented 9 years ago

Hmm - the only other thing that I can see effects it is if you change the settings on here:

screen shot 2015-05-18 at 17 36 36

(If just creating references it fails)

nicinabox commented 9 years ago

AH! That changes things.

I get all the swift files in Compile Sources and the Objective-C Bridging Header option.

Nice work!

kirkness commented 9 years ago

Awesome - cheers mate!

nicinabox commented 9 years ago

Thanks for your help @kirkness!