方法' FeedShare'需要的6 & # 39;Facebook SDK v7.1.0 Unity
本文关键字:SDK Facebook v7 Unity FeedShare 方法 | 更新日期: 2023-09-27 18:14:35
我正在与Facebook共享游戏,但我一直得到这个错误:
方法FeedShare' takes
6'参数不能重载
我的代码
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Facebook.Unity;
public class FBHolder : MonoBehaviour {
void Awake ()
{
FB.Init (SetInit, OnHideUnity);
}
private void SetInit ()
{
Debug.Log ("Facebook Init done");
if (FB.IsLoggedIn) {
Debug.Log ("Facebook logged in");
} else {
FBLogin();
}
}
private void OnHideUnity (bool isGameShown)
{
if (!isGameShown) {
Time.timeScale = 0;
} else {
Time.timeScale = 1;
}
}
void FBLogin()
{
var perms = new List<string> (){"public_profile", "email", "user_friends"};
FB.LogInWithReadPermissions (perms, AuthCallback);
}
private void AuthCallback (ILoginResult result) {
if (FB.IsLoggedIn) {
Debug.Log("FB Login Worked");
// share facebook
FB.FeedShare(
link: "https://enterlinkhere.com",
linkName: "PollyCube",
linkCaption: "LinkCaption",
linkDescription: "LinkDescription",
picture: "https://enterimagehere.com",
callback: LogCallback
);
}
else {
Debug.Log("User cancelled login");
}
}
void LogCallback(IResult response) {
Debug.Log("Worked");
}
}
这是Facebook Feedshare的代码(也在我上面发布的代码中)
FB.FeedShare(
link: "https://enterlinkhere.com",
linkName: "PollyCube",
linkCaption: "LinkCaption",
linkDescription: "LinkDescription",
picture: "https://enterimagehere.com",
callback: LogCallback
);
void LogCallback(IResult response) {
Debug.Log("Worked");
}
我使用这个文档来做这个,以防你想知道我从哪里得到这个
https://developers.facebook.com/docs/unity/reference/current/FB.FeedShare试试这个:
FB.FeedShare(
string.Empty, //toId
new System.Uri("https://enterlinkhere.com"), //link
"PollyCube", //linkName
"LinkCaption", //linkCaption
"LinkDescription", //linkDescription
new System.Uri("https://enterimagehere.com"), //picture
string.Empty, //mediaSource
LogCallback //callback
);
您缺少toID字段-即使他们说"您不需要指定toID来发布到当前用户的时间轴-只需将其保留为空。",这并不意味着你不能输入参数!
试着输入"或字符串。空相反…
尝试用此
替换链接和图片新System.Uri("https://enterlinkhere.com"),