I'm trying to send an image in NSData format via bluetooth from one device to
another. Below is my code:
-(void)sendDataToPeer:(NSString*)peerID andSession:(GKSession*)session
{
if ([connections objectForKey:peerID]) {
[delegate cardSent:[session displayNameForPeer:peerID]];
}
NSError * error;
NSData * data = [delegate cardData];
NSLog(@"About to send data %i",[data length]);
int started = [session sendData:data toPeers:[NSArray
arrayWithObject:peerID]
withDataMode:GKSendDataReliable error:&error];
NSLog(@"Data Sent %i Error:%@",started,error);
if(started){
[connections setObject:@"Sent" forKey:peerID];
[delegate cardSent:peerID];
}
else {
[delegate cardFailed];
}
}
And when I try to send, this is the error I get every time:
Error Domain=com.apple.gamekit.GKSessionErrorDomain Code=30202
UserInfo=0x145e80 "Send data error."
Any idea what I'm doing wrong?_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]