Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Xcode building errors: [Definition of 'Pushwoosh' must be imported from module 'Pushwoosh.Pushwoosh' before it is required] + [Duplicate interface definition for class 'Pushwoosh'] #106

Closed mrsasuu closed 4 years ago

mrsasuu commented 4 years ago

Description

Build fail due to 2 errors right after installing the package as explained here.

Error 1:

<pathToProject>/<react-native-app>/node_modules/pushwoosh-react-native-plugin/src/ios/PushwooshPlugin/Pushwoosh.h:28:1: Duplicate interface definition for class 'Pushwoosh'

Error 2:

<pathToProject>/<react-native-app>/node_modules/pushwoosh-react-native-plugin/src/ios/PushwooshPlugin/Pushwoosh.m:34:17: Definition of 'Pushwoosh' must be imported from module 'Pushwoosh.Pushwoosh' before it is required

Steps To Reproduce

Create a new react-native project => Install pushwoosh-react-native-plugin => install ios pods => open Xcode => build debug on device

Additional Information

zigoval commented 4 years ago

I ran into the same issues, even if it used to works before. I tried deleting build / derived data / pod / nodes_modules but nothings worked.

I find a way to make it works : Error 1: Capture d’écran 2020-07-20 à 13 47 31 Uncheck pushwoosh-react-native-plugin (Red Arrow) then click on the second error (first blue arrow), red arrow again. Do it again with the second arrow. run again.

The error should appear again so you need to do it again. (2 or 3 times in total i think)

Then it should works. (it did for me). The first time, i had the error n°2, i changed the import to And i had no error at all. But if you run pod install again, you need to redo all the step. (weird thing here, i didn't run into error n°2 the second time, and i have an error on duplicate interface but i can build anyway and my app is working great.

I found several interface Pushwoosh on the node_modules, because there is a public and a private folder. I don't know what does it do. I might come from here.

I hope i was clear enough. Good luck

Edit : it seems that Pushwoosh is not undefined when using react-native run-ios but works fine when using Xcode

piotr-marat commented 4 years ago

same issue here

wfhm commented 4 years ago

@mrsasuu, @zigoval, @piotr-marat

Checking it.

makarkotlov commented 4 years ago

same, after trying @zigoval suggestion build was successful but pushwoosh has become undefined

wfhm commented 4 years ago

@mrsasuu, @zigoval, @piotr-marat, @makarkotlov,

Got it reproduced, will be fixed with the next release.

Meanwhile, you can use the following workaround - open your iOS project in Xcode, Edit -> refactor -> rename class ".../node_modules/pushwoosh-react-native-plugin/src/ios/PushwooshPlugin/Pushwoosh.h" to PushwooshPlugin.

SagivOnoApps commented 4 years ago

@wfhm

this workaround did half the job for me(perhaps i was doing it wrong) I managed to compile but still Pushwoosh was null in my app

after some digging the trick that fixed that was inserting Pushwoosh into RCT_EXPORT_MODULE:

RCT_EXPORT_MODULE(Pushwoosh); in node_modules/pushwoosh-react-native-plugin/src/ios/PushwooshPlugin/Pushwoosh.m

zigoval commented 4 years ago

The new update fixed it !! thanks a lot !

wfhm commented 4 years ago

Fixed with the latest release.