Я реализовал игровой набор.Теперь все отлично работает.Но если пользователь нажимает при отправке, данные мгновенно отправляются на другой iphone / ipod / ipad, и они мгновенно записываются.
Так что теперь я хотел реализовать экран подтверждения для получателя.* В моем методе receiveData (из gamekit) у меня есть массив.Если пользователь нажимает да, массив будет записан в файл. Если он не будет записан в файл.
#pragma mark -
#pragma mark - GKreceiveData
- (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession: (GKSession *)session context:(void *)context
{
NSDictionary *dict = [NSKeyedUnarchiver unarchiveObjectWithData:data];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incoming Set" message:[NSString stringWithFormat:@"%@ wants to send you a Set named: \n\n %@",[session displayNameForPeer:peer], [dict valueForKey:@"SetName"]] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
//NSLog(@"ok");
//this should happen if the user presses on ok on the alertview.
[dataArray addObject:dict]; //i can't acess "dict"
}
else
{
//NSLog(@"cancel");
}
}
Вы видите проблему ??А что я могу сделать??