在更新到Swift 2.0之后,使用iOS多重连接,遇到以下代码问题:
var advertiser:MCNearbyServiceAdvertiser!
var peer:MCPeerID!
func startEndAdvertising(value:Bool)
{
if advertiser == nil
{
var someObject: [String : AnyObject] = ["profileName" : DataCentral.getInstance.userPeerVO.peerName]
advertiser = MCNearbyServiceAdvertiser(peer: peer, discoveryInfo: someObject, serviceType: "shadow-chat")
advertiser.delegate = self
}
}
以下行生成错误为“无法使用类型'的参数列表调用类型'MCNearbyServiceAdvertiser'的初始化者'(peer:MCPeerID!,discoveryInfo:[String:AnyObject],serviceType:String)'”
advertiser = MCNearbyServiceAdvertiser(peer: peer, discoveryInfo: someObject, serviceType: "shadow-chat")