I want to make a GroupChat application using Multipeer Connectivity Framework. Al first , I initialize the session by this code
self.peerID =[[MCPeerID alloc] initWithDisplayName:[UIDevice currentDevice].name];
self.session = [[MCSession alloc] initWithPeer:self.peerID];
self.session.delegate =self;
Then I try to send message with all connected peer devices by this following code.
NSData *data = [message dataUsingEncoding:NSUTF8StringEncoding];
if (![self.session sendData:data
toPeers:@[self.remotePeers]
withMode:MCSessionSendDataReliable
error:&error]) {
NSLog(@"[Error] %@", error);
}
But this gives the following error
Error Domain=MCSession Code=1 "Peers (
(
"iPhone Simulator"
)
) not connected" UserInfo=0x155e0cc0 {NSLocalizedDescription=Peers (
(
"iPhone Simulator"
)
) not connected}
Here "iPhone Simulator" is the nearby peerDevice. Please Help Me. Thank You.