iOS MQTT使用ssl前缀 解决方法

MQTTCFSocketTransport *transport=[[MQTTCFSocketTransport alloc]init];
transport.host=MQTT_host;
transport.port=MQTT_port;

//这一句关键
transport.tls=YES;

self.mqttSession = [[MQTTSession alloc] init];
_mqttSession.transport=transport;
_mqttSession.delegate=self;
[_mqttSession setUserName:MQTT_userName];
[_mqttSession setPassword:MQTT_pwd];
[_mqttSession connectAndWaitTimeout:10];

你可能感兴趣的:(iOS MQTT使用ssl前缀 解决方法)