Вопрос

At the moment I'm working on a iPhone app and I have a problem. I want, that the player can send a gamecenter friendrequest.

In the apple Guide there are two methods I'm interested in. The first would be

- (void)addRecipientsWithPlayerIDs:(NSArray *)playerids

and the second would be

- (void)setMessage:(NSString *)message

Now I don't know to put them in the right order to get on. How can I set the player ID's and the message, and after that, how can I send the request.

Это было полезно?

Решение

Suppose you have player ids in friendsArray. Then try this:

GKFriendRequestComposeViewController *friendRequestViewController = [[GKFriendRequestComposeViewController alloc] init];
friendRequestViewController.composeViewDelegate = self;
[friendRequestViewController setMessage:@"Add your message here"];
if (friendsArray)
{
    [friendRequestViewController addRecipientsWithPlayerIDs: friendsArray];
}
[self presentModalViewController: friendRequestViewController animated: YES];

Hope this helps.. :)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top