【发布时间】:2013-12-05 17:06:22
【问题描述】:
如何发送一个名为 Deck *deck 的核心数据对象,它包含一个 NSString、一个 NSData 照片对象和一个 NSSet(与其他实体的一对多关系)。
根据调试控制台,当我尝试使用 [GKMatch sendData:toPlayers:] 方法发送 Deck *deck 时,NSData *outgoingPacket 仍然为零,但 *deck 有一个地址。
- (void) sendDeck {
NSError *error;
NSData *outgoingPacket = [NSData dataWithBytes:&_deck length:sizeof(_deck)];
[self.myMatch sendData:outgoingPacket toPlayers:[NSArray arrayWithObject:self.pickerViewFriend] withDataMode:GKMatchSendDataReliable error:&error];
//myMatch is an instance of GKMatch.
//_deck is an instance variable set by @property Deck *deck, which is assigned by a UIPickerView, which works perfectly
}
(我意识到这甚至没有解决发送与套牌相关的卡片,但我被困在这一点上)
【问题讨论】:
标签: ios core-data game-center