• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iPhone: Lost with GK
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone: Lost with GK


  • Subject: Re: iPhone: Lost with GK
  • From: Development <email@hidden>
  • Date: Sun, 7 Feb 2010 09:53:24 -0700

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

  • Follow-Ups:
    • Re: iPhone: Lost with GK
      • From: Luke the Hiesterman <email@hidden>
References: 
 >iPhone: Lost with GK (From: Development <email@hidden>)

  • Prev by Date: Re: Uncaught exceptions not terminating my app
  • Next by Date: Re: Debugging (apparently) random retain loop bug (NSArrayController)
  • Previous by thread: iPhone: Lost with GK
  • Next by thread: Re: iPhone: Lost with GK
  • Index(es):
    • Date
    • Thread