Я хочу отправить запрос на игру своим друзьям из facebook. Следующий код отправляет запросы на приглашение, если у получателя не установлено приложение.
Я просмотрел всю имеющуюся документацию (хотя ее немного), и я не уверен, в чем может быть ошибка. Ниже приведен фрагмент кода:
void FacebookInterface::postGameRequest(std::string title, std::string message, std::string pids,
std::string dataJson, int friendType, int inviteType)
{
FBSDKGameRequestDialog *gameReq = [[FBSDKGameRequestDialog alloc] init];
if ([gameReq canShow]) {
gameReq.content =[[FBSDKGameRequestContent alloc] init];
gameReq.content.data = [NSString stringWithUTF8String:dataJson.c_str()];
gameReq.content.message = [NSString stringWithUTF8String:message.c_str()];
gameReq.content.title = [NSString stringWithUTF8String:title.c_str()];
GameRequestDelegate* delegate = [[GameRequestDelegate alloc] init];
int count = 0;
if (!pids.empty()) {
NSArray* receipients = [[NSString stringWithUTF8String:pids.c_str()] componentsSeparatedByString:@","];
gameReq.content.recipients = receipients;
count = (int) [receipients count];
delegate.toList = pids;
delegate.count = count;
} else {
gameReq.content.filters = FBSDKGameRequestFilter::FBSDKGameRequestFilterAppNonUsers;
delegate.count = 0;
}
delegate.friendType = friendType;
delegate.inviteType = inviteType;
gameReq.delegate = delegate;
gameReq.frictionlessRequestsEnabled = YES;
FabricAnswersInterface::getInstance()->logEvent(title, std::to_string(friendType), count);
[gameReq show];
}
}