0

How do i solve this error?

2016-08-30 09:14:55.856 BBS[476:159483] -[MosquittoClient initWithClientId:]: unrecognized selector sent to instance 0x15e3ba60
2016-08-30 09:14:55.859 BBS[476:159483] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:

'-[MosquittoClient initWithClientId:]: unrecognized selector sent to instance 0x15e3ba60' *** First throw call stack: (0x21d19b0b 0x214d6dff 0x21d1f455 0x21d1d0ab 0x21c47298 0xaeec8 0xaedb8 0xae484 0xae570 0x2632a6a1 0x2632a631 0x2631256b 0x26329f51 0x26329bbf 0x26322547 0x262f2dd5 0x262f1379 0x21cdb9e7 0x21cdb5d7 0x21cd993f 0x21c281c9 0x21c27fbd 0x23244af9 0x2635b435 0xaf8e8 0x218d4873) libc++abi.dylib: terminating with uncaught exception of type NSException

FYI: I have a project that is using Mosquitto library and it is working. However when i copy the original source code to another Mac for distribution or when i create a new project and integrate Mosquitto library into it, the error appear.

client = MosquittoClient(clientId: "client1") <-- Line that causes the error
client?.delegate = self
client?.port = 1883
client?.host = "someIPAddress"
client?.connect()

1 Answers1

0

Do not hard code client IDs, they need to be different for every instance connected to the broker.

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • It is only an example here. For my project, the client id is a variable that takes in different client id from different user. And it still causes error – Wei Meng C. Aug 30 '16 at 06:37