Re: iPhone: Lost with GK
Re: iPhone: Lost with GK
- Subject: Re: iPhone: Lost with GK
- From: Luke the Hiesterman <email@hidden>
- Date: Sun, 7 Feb 2010 08:58:30 -0800
The size sounds like a problem. I don't remember the exact limit, but I seem to recall the send buffer is just under 100k. You'll want to break that up into packets.
Luke
On Feb 7, 2010, at 8:53 AM, Development wrote:
> Ok I think I am making headway.
>
> I am storing an NSDictionary object that contains several bits of string data and an image in png format saved as plain nsdata. I am using the NSKeyedArchiver to write the data to disk then attempting to send that via bluetooth to another iphone. However it fails to send that data. BUT if I send a plain string converted to NSData it works fine. Is it the size of the data that is causing the failure possibly? The total size is 147K
>
>
>
> On Feb 6, 2010, at 10:36 PM, Development wrote:
>
>> 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@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden