ios - 使用 Xcode 在 iOS 上实现多点连接

标签 ios iphone swift xcode multipeer-connectivity

广告和浏览的设备。 尝试建立连接时出现问题。

func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {}

尝试连接时正常工作,但几秒钟后,它再次调用 MCSessionState == .notConnected

尝试了 WiFi、BT 以及两者之间的所有组合...

刚刚添加:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
    <false/>
</dict>

没有太大帮助...仍然进入控制台(不过只是在 iOS 10.2 设备上...):

2017-02-06 15:17:37.858063 Advertiser[1149:316236] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)
2017-02-06 15:17:39.727633 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:39.808822 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:39.948454 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:40.179569 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:40.591829 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:41.297454 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:42.547840 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:44.077537 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:45.601568 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:47.125030 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR]  Send BINDING_REQUEST failed(C01A0041).
2017-02-06 15:17:48.110301 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [0].
2017-02-06 15:17:48.111331 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [1].
2017-02-06 15:17:48.111526 Advertiser[1149:316267] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)
2017-02-06 15:17:48.111705 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [2].
2017-02-06 15:17:48.111873 Advertiser[1149:316267] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)
2017-02-06 15:17:48.112042 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [3].
2017-02-06 15:17:48.113031 Advertiser[1149:316267] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)
2017-02-06 15:17:48.121016 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [4].
2017-02-06 15:17:48.121321 Advertiser[1149:316267] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)
2017-02-06 15:17:48.121506 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [5].
2017-02-06 15:17:48.121683 Advertiser[1149:316267] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)

(广告商是应用程序的名称) 使用带有 10.2 的 iPhone 6S 和带有 9.2 的 iPhone 6。 从 Xcode 8.2.1 (Swift3) 使用 macOS Sierra v10.12.2 在 Macbook Pro 上运行代码。

最佳答案

您是否为广告客户和浏览器保留了对 MCSession 对象的引用?如果正在使用的 MCSession 对象被释放,就会出现那些 BINDING_REQUEST 失败消息。

关于ios - 使用 Xcode 在 iOS 上实现多点连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42069281/

相关文章:

android - Unity 和 2d 应用程序

iphone - ARC 和 MBProgressHUD

ios - 构建基本应用程序 iOS 应用程序 - 单一 View - 最佳实践

swift - 从skSpriteNode位置获取tileGroup

ios - 如何对 MKAnnotationViews 进行 z 排序?

ios - 如何识别 Remote 保持?

objective-c - 在NSArray中增加NSNumber

ios - 如何防止在 UIPicker View 中快速选择无效日期?

iphone - 使用 CATransition 从当前位置滑动图像 400px

iphone - UISwitch 在 UITableView 的滚动上取消切换