
以下是代码:
private func setUpSession() { self.session = MCSession(peer: self.peerID); self.session!.delegate = self; self.browser = MCNearbyServicebrowser(peer: self.peerID,serviceType: "stc-classroom-vik"); self.browser!.delegate = self; self.advertiser = MCNearbyServiceAdvertiser(peer: self.peerID,discoveryInfo: nil,serviceType: "stc-classroom-vik"); self.advertiser!.delegate = self;} 这是我得到的崩溃/错误:
2014-08-15 12:24:42.689 XavIEr[614:254319] *** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: 'InvalID serviceType passed to MCNearbyServicebrowser'
我真的很感激任何帮助.
解决方法 我相信你只允许在你的serviceType参数字符串中使用一个连字符,并且它必须是15个字符或更少.你的有两个连字符和17个字符.从MCNearbyServicebrowser()的注释:
总结The serviceType parameter is a short text string used to describe the app’s networking protocol. It should be in the same format as a Bonjour service type: up to 15 characters long and valID characters include ASCII lowercase letters,numbers,and the hyphen. A short name that distinguishes itself from unrelated services is recommended; for example,a text chat app made by ABC company Could use the service type “abc-txtchat”.
以上是内存溢出为你收集整理的ios – Multipeer Connectivity:无效的服务类型全部内容,希望文章能够帮你解决ios – Multipeer Connectivity:无效的服务类型所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)