[英]Facebook SDK Unity Invite
我正在連接到facebook的女巫中開發一款Android游戲。 如果用戶已連接,則他可以邀請其Facebook用戶中的5個人加入該應用程序。 我用了這段代碼。 當用戶單擊“邀請”按鈕時,我希望在腳本InteractiveConsole.cs中使用該問題,他只能邀請5個朋友,選擇5個朋友時,不能邀請5個以上。這是我的代碼:
#region FB.AppRequest() Friend Selector
public string FriendSelectorTitle = "";
public string FriendSelectorMessage = "Derp";
public string FriendSelectorFilters = "[\"all\",\"app_users\",\"app_non_users\"]";
public string FriendSelectorData = "{}";
public string FriendSelectorExcludeIds = "";
public string FriendSelectorMax = "";
private void CallAppRequestAsFriendSelector()
{
// If there's a Max Recipients specified, include it
int? maxRecipients = null;
if (FriendSelectorMax != "")
{
try
{
maxRecipients = Int32.Parse(FriendSelectorMax);
}
catch (Exception e)
{
status = e.Message;
}
}
// include the exclude ids
string[] excludeIds = (FriendSelectorExcludeIds == "") ? null : FriendSelectorExcludeIds.Split(',');
FB.AppRequest(
FriendSelectorMessage,
null,
FriendSelectorFilters,
excludeIds,
maxRecipients,
FriendSelectorData,
FriendSelectorTitle,
Callback
);
}
#endregion
謝謝你的幫助。
我發現了為什么它不起作用。 首先將我的應用程序中邀請的朋友數量限制為5個,我應該更改此設置:
public string FriendSelectorMax = "5";
我再次輕描淡寫了文檔,並說了這一點。
“ maxRecipients:與平台有關。用戶應該能夠在平台多好友選擇器對話框中選擇的最大收件人數。只能保證在Unity Web Player應用程序中工作。”
這是鏈接: https : //developers.facebook.com/docs/unity/reference/current/FB.Apprequest
人們認為maxRecipients可以在WebPlayer中使用,而在android之前不能使用。
我在統一網絡播放器中測試了代碼,我只能邀請5個朋友,而當我將平台切換為android時,它無法按照文檔中的說明運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.