MQTT-Client-Framework icon indicating copy to clipboard operation
MQTT-Client-Framework copied to clipboard

Can run on Simulator iPhone any but Not real iPhone.

Open rsnbusa opened this issue 6 years ago • 8 comments

Short description

Can run on the Simulator but when building for a real iPhone will fail with Linker errors.

Undefined symbols for architecture arm64: "OBJC_CLASS$_MQTTSession", referenced from: objc-class-ref in MQTTSwift.o ld: symbol(s) not found for architecture arm64

Environment

XCODE 9.3 Mixed Objective-C and Swift (handling the MqttClient) Manual Copied MqttClient.framework and CocaoLumberjack.framework to Resources folder Broker is cloudmqtt.com

Steps to reproduce

Build app with Simulator iPhone8 or 8s or whatever. No compile errors, no link errors. Runs in the Simulator without any problems. All calls. SSL or unsecure.

Now change to Roberts iPhone (iPhone 8). Build and get the linker errors.

Also install a podfile with pod 'MAQTTClient' pod 'MQTTClient/MinL' pod 'MQTTClient/ManagerL' pod 'MQTTClient/WebsocketL'

Pod Install w/o any errors. Build for Simulator NO PROBLEM, build for iPhone same error.

Help please, I just converted an old Paho Mosquitto library to yours.

rsnbusa avatar Sep 14 '18 23:09 rsnbusa

Hi. Long night but got something.

I used the MQTTSwift project that came with the download as the MQTT controller.

Used much of the code, specially the session?.close() and session!.connect(toHost: self.server, port: lport, usingSSL: secure). It worked perfectly. I sent and received msgs from MQTT.fx and the broker (cloudmqtt.com)

Installed it in the iPhone and also worked.

With my App, which is Objective-c and Swift, I update to cocoapods with a podfile that included pod 'MQTTClient' without problems. When compiling it gave 2 errors, that if I commented them, it would compile and install in an iPhone. First problem solved.

The 2 errors are related to session.close() and session.connect() that is a copy of the MQTTSwift app. The error for session?.close() Cannot invoke 'close' with no arguments.

For the session!.connect(toHost: self.server, port: lport, usingSSL: secure) Cannot invoke 'connect' with an argument list of type '(toHost: String?, port: UInt32, usingSSL: Bool)'

Am I missing a framework or import?. Why do these 2 calls work in a Swfit app and not in a mixed Objective-c and Swift.

Everything is the same environment, e.i., Xcode version, Mac, broker, etc.

Attaching swift code of my Objective-C and Swift app. The Swift app is the one from the github download which is MQTT-Client-Framework/MQTTSwift/MQTTSwift/MQTTSwift.swift

MQTTSwift.swift.zip

Thanks for your help.

rsnbusa avatar Sep 15 '18 18:09 rsnbusa

You can use some of other APIs like one with disconnectHandler and pass empty block.

jcavar avatar Sep 15 '18 22:09 jcavar

Yes I know. I was just wandering why it does not work and I found that the cocoapods download is different from this download. MQTTSessionLegacy is very different

Could you tell me where I can find documentation to what you are referring to? I cant find documentation to read to make a connect-close own routine.

Thanks.

rsnbusa avatar Sep 16 '18 18:09 rsnbusa

Found it. Its in branch M5, but not under Master.

rsnbusa avatar Sep 16 '18 23:09 rsnbusa

build arm64 architecture in Build Active Architectures->Debug->NO

1129921824 avatar Sep 17 '18 06:09 1129921824

Thanks.

RSN

rsnbusa avatar Sep 17 '18 14:09 rsnbusa

Hello @rsnbusa i am having the same probelem can you just elaborate how you solved it?

akshar001 avatar Oct 25 '18 16:10 akshar001

I did not. I changed the Mqtt Library to CocoaMqtt which comes in a Pod.

RSN

On Oct 25, 2018, at 11:35 AM, akshar001 [email protected] wrote:

Hello @rsnbusa https://github.com/rsnbusa i am having the same probelem can you just elaborate how you solved it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/novastone-media/MQTT-Client-Framework/issues/503#issuecomment-433120627, or mute the thread https://github.com/notifications/unsubscribe-auth/AIITq3YQxMaR4mPZP_qjcynWmBlff2ZUks5uoehBgaJpZM4WqFTc.

rsnbusa avatar Oct 25 '18 18:10 rsnbusa