如何解决此错误?
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:]:发送到的无法识别的选择器 实例0x15e3ba60' ***第一次抛出调用堆栈: (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:以NSException类型的未捕获异常终止
仅供参考:我有一个使用Mosquitto库的项目,它正在运行。但是,当我将原始源代码复制到另一台Mac进行分发时,或者当我创建一个新项目并将Mosquitto库集成到其中时,会出现错误。
client = MosquittoClient(clientId: "client1") <-- Line that causes the error
client?.delegate = self
client?.port = 1883
client?.host = "someIPAddress"
client?.connect()
答案 0 :(得分:0)
不要对客户端ID进行硬编码,对于连接到代理的每个实例,它们都需要不同。