ios - 如何将接收方的 ACCEPT 和 DECLINE 操作通知发送方?

标签 ios objective-c multipeer-connectivity

在多对等框架中,如果发送者向接收者发送邀请并且接收者拒绝它。 那么有什么方法可以检查接收者拒绝邀请吗?

[self.browser invitePeer:peerID
                       toSession:self.session
                     withContext:nil
                         timeout:INVITE_TIMEOUT];

最佳答案

阅读MCSession documentation :

If you use one of the framework’s browser objects for peer discovery, when a peer accepts an invitation, the session calls its delegate object’s session:peer:didChangeState: method with MCSessionStateConnected as the new state, along with an object that tells you which peer became connected.

并检查 session:peer:didChangeState: documentation ,我看到了这个:

This delegate method is called with the following state values when the nearby peer’s state changes:

  • MCSessionStateConnected—the nearby peer accepted the invitation and is now connected to the session.

  • MCSessionStateNotConnected—the nearby peer declined the invitation, the connection could not be established, or a previously connected peer is no longer connected.

关于ios - 如何将接收方的 ACCEPT 和 DECLINE 操作通知发送方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50138064/

相关文章:

ios - 如何检测 UIImageView 的触摸事件?

ios - SCNBox 在每张脸上都有不同的颜色或纹理

iphone - 如何将 adWhirl 置于 iPhone 屏幕底部?

ios - objc_setAssociatedObject 保留原子或非原子

ios - MultiPeer MCNearbyBrowserService 崩溃

ios - UIButton 的剪辑图像

ios - 关闭当前的 UIViewcontroller 并呈现一个新的 UiViewController

ios - 多点连接 : Invalid service type

android - Android 的多点连接

iphone - 将按钮添加到导航栏 ios