shehankonecranes / sp-react-native-mqtt

MQTT Client native module for react-native
68 stars 55 forks source link

Add typescript definition. #1

Closed taoqf closed 5 years ago

taoqf commented 5 years ago

Hi, I want use your great lib https://www.npmjs.com/package/sp-react-native-mqtt, but I am new on ios, so I don't know what does Add pod 'MQTTClient' to your podfile and pod install mean, and How can I do this?

I tried in 2 ways:

1.

cd `my project/node_mobules/sp-react-native/ios'

vi Podfile


platform :ios, '12.2'

target "MQTTClient" do

project 'pods/MQTTClient.xcodeproj'

pod 'MQTTClient'

end

pod install (and I get a warning here)

Then I got an error which says could not find header file MQTTClient.h,

so I add the pods/mqttclient add header search path into RCTMqtt.xcodeprj, even did not work.

2. cd `my project/ios' I did not get a Podfile here, so I create one.

vi Podfile


platform :ios, '12.2'

target "myapp" do

project 'myapp.xcodeproj'

pod 'MQTTClient'

end

pod install

then I compile the project, and get linking error.

Could you pls show me the right way to do this? thanks.

By the way, is this able to be done with react-native link?

SudoPlz commented 5 years ago

I'm at the beach right now, I'll check it out later today. We'll be using this library in production in less that a month.

taoqf commented 5 years ago

Take your time.

taoqf commented 5 years ago

@SudoPlz Please add more details to readme about link this lib on IOS, If you have time, Thanks.

SudoPlz commented 5 years ago

I'll try to do that, yes

taoqf commented 5 years ago

@SudoPlz any news?

SudoPlz commented 5 years ago

@taoqf I've added an example project and updated Readme.

Basically what I did was on the root of the new example project I did:

npm install sp-react-native-mqtt --save react-native link sp-react-native-mqtt cd ios pod init Added pod 'MQTTClient' in /ios/Podfile like so https://github.com/SudoPlz/sp-react-native-mqtt/blob/master/rnmqttexample/ios/Podfile#L7 then did pod install then followed the android steps from readme voila

taoqf commented 5 years ago

Thanks, I'll try it later.

taoqf commented 5 years ago

I got too many trouble on ios, so I did this: https://www.npmjs.com/package/@taoqf/react-native-mqtt. it is easy to use and do not depend on any native module.