Tag: 多路连接

通过Multipeer连接发送和接收邀请

我知道这个问题之前已经被问过了,但是我只是想知道为什么这个问题不适合我的情况。 我试图从一个视图控制器发送multipeer连接的邀请,并在另一个视图控制器上接收。 我的代码发送它是: [self invitePeer:selectedPeerID toSession:self.mySession withContext:nil timeout:timeInterval ]; 和方法只是空白: – (void)invitePeer:(MCPeerID *)peerID toSession:(MCSession *)session withContext:(NSData *)context timeout:(NSTimeInterval)timeout { } 我的代码接收和邀请是: – (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler { // http://down.vcnc.co.kr/WWDC_2013/Video/708.pdf — wwdc tutorial, this part is towards the end (p119) self.arrayInvitationHandler = [NSArray arrayWithObject:[invitationHandler copy]]; // ask the user UIAlertView […]

IOS7 Multipeer连接使用广告客户的发现信息创build自定义附近的浏览器列表

我在IOS7中使用Multipeer连接框架来创build一个聊天应用程序。 我正在使用内置的MCBrowserViewController来显示附近的同伴列表。 我想在附近的对等列表中包含广告客户的个人资料信息。 这样浏览器就可以看到一个包含图像的列表以及附近同行的一些数据。 我认为可以通过在广告客户初始化时通过discoveryInfo传递数据来完成。 我像这样传递discoveryInfo数据: // create Discovery Info NSArray *objects=[[NSArray alloc] initWithObjects:@"datguy",@"28", nil]; NSArray *keys = [[NSArray alloc] initWithObjects:@"Name",@"Age", nil]; self.dictionaryInfo = [[NSDictionary alloc] initWithObjects:objects forKeys:keys]; // Setup Advertiser self.advertiser = [[MCAdvertiserAssistant alloc] initWithServiceType:@"txt_msg_service" discoveryInfo:self.dictionaryInfo session:self.advertiseSession]; [self.advertiser start]; 但有没有什么办法可以创build一个自定义的MCBrowserViewController在另一端显示discoveryInfo,而不是使用内置的? 有没有人有任何示例代码?