emqx / CocoaMQTT

MQTT 5.0 client library for iOS and macOS written in Swift
https://www.emqx.com/en
Other
1.59k stars 418 forks source link

compatible with iOS 15.1.1? #425

Closed lph65724 closed 2 years ago

lph65724 commented 2 years ago

My application is running well so far on iOS 14.8 and iOS 15.0, but publish never gets fired when I try my application on iOS 15.1.1, nor I can receive any message from the device on iOS 15.1.1. Is there a compatibility issue with iOS 15.1.1? Thank you

leeway1208 commented 2 years ago

Hi ,Which tag or release do you use?

lph65724 commented 2 years ago

I am using '1.3.0-rc.2'

leeway1208 commented 2 years ago

@lph65724 Hi,I create a new project using 1.3.0-rc.2 and try publishing on IOS 15.1.1. But there is no mistake. So please provide us with more detailed information? Or you can provide us an example project to check this issue. thank you.

lph65724 commented 2 years ago

@lph65724 Hi,I create a new project using 1.3.0-rc.2 and try publishing on IOS 15.1.1. But there is no mistake. So please provide us with more detailed information? Or you can provide us an example project to check this issue. thank you.

Thank you for the reply. I have just found out it runs fine on iPhone with iOS 15.1.1, but not iPad mini with iPadOS 15.1. Actually, it is iPadOS 15.1 that publish won't fire. I apologize for the misinformation. How do I make it work on iPadOS? Thank you

leeway1208 commented 2 years ago

Hi~. I test 1.3.0-rc.2 version on ipad and can not reproduce. You may provide the log or example project for us to check.

lph65724 commented 2 years ago

Hi~. I test 1.3.0-rc.2 version on ipad and can not reproduce. You may provide the log or example project for us to check.

@leeway1208 I can't provide you any log because there is no log printed at all. When I run my app, I subscribe to topics, and it's supposed to print if the subscription is successful or not, but there is any.

This line is printed when I send the message out on iPad and that's all. 2021/12/14 15:03:33 >>>>> in mode control, message = {"f":"2","p":{"m":"mode","p":{"md":"3","br":"10"}},"t":"4"}

The following are printed when I run my app and send the message out on an iPhone

[TRACE] [didSubscribeTopics]: success: { “Xxxxx” = 1; } [TRACE] [didSubscribeTopics]: success: { “Xxxxx” = 1; }

2021/12/14 15:07:05 >>>>> in mode control, message = {"f":"2","p":{"p":{"md":"3","br":"10"},"m":"mode"},"t":"4"} [TRACE] [didPublishMessage]: message: {"f":"2","p":{"p":{"md":"3","br":"10"},"m":"mode"},"t":"4"}, id: 6 [TRACE] [didPublishAck]: id: 6 [TRACE] [didReceiveMessage]: message: {"mac”:”xxxxxx”,”payload":{"opMode":"3","selectMode":"3"}}, id: 0. --> returned message from device [TRACE] [didReceiveMessage]: message1: xxxxxxx. --> my topic

By the way, I set a breakpoint at the publish function, it stops as expected when I run on iPhone, but it doesn't on iPad. public func publish(_ topic: String, withString string: String, qos: CocoaMQTTQoS = .qos1, retained: Bool = false) -> Int { let message = CocoaMQTTMessage(topic: topic, string: string, qos: qos, retained: retained) return publish(message) }

leeway1208 commented 2 years ago

@lph65724 Thank you for your details. But it is hard to find out the issue. Do you have the same problem with our example? Make sure your iphone and iPad are in the same network state and do not use any VPN.

lph65724 commented 2 years ago

@lph65724 Thank you for your details. But it is hard to find out the issue. Do you have the same problem with our example? Make sure your iphone and iPad are in the same network state and do not use any VPN.

@leeway1208 I removed my app from the iPad and reinstalled it, and now everything works just fine. Simply installing the app via Xcode didn't fix the problem, but removing the app from the iPad and reinstalling it fixed the problem. I still have no idea why this happened. Anyway, thank you so much for your help