这是我的FB.cs文件的代码,默认情况下是unity fb sdk的代码。如果您在第10行看到我已经将默认无摩擦请求标记为true,方法是删除变量并将值设置为true。
private static bool frictionlessRequests=true;
public static void Init(InitDelegate onInitComplete, HideUnityDelegate onHideUnity = null, string authResponse = null)
{
Init(
onInitComplete,
FBSettings.AppId,
FBSettings.Cookie,
FBSettings.Logging,
FBSettings.Status,
FBSettings.Xfbml,
true,//FBSettings.FrictionlessRequests,
onHideUnity,
authResponse);
}
/**
* If you need a more programmatic way to set the facebook app id and other setting call this function.
* Useful for a build pipeline that requires no human input.
*/
public static void Init(
InitDelegate onInitComplete,
string appId,
bool cookie = true,
bool logging = true,
bool status = true,
bool xfbml = false,
bool frictionlessRequests = true,
HideUnityDelegate onHideUnity = null,
string authResponse = null)
{
FB.appId = appId;
FB.cookie = cookie;
FB.logging = logging;
FB.status = status;
FB.xfbml = xfbml;
FB.frictionlessRequests = frictionlessRequests;
FB.authResponse = authResponse;
FB.OnInitComplete = onInitComplete;
FB.OnHideUnity = onHideUnity;
if (!isInitCalled)
{
FbDebug.Info(String.Format("Using SDK {0}, Build {1}", FBBuildVersionAttribute.SDKVersion, FBBuildVersionAttribute.GetBuildVersionOfType(typeof(IFacebook))));
#if UNITY_EDITOR
FBComponentFactory.GetComponent<EditorFacebookLoader>();
#elif UNITY_WEBPLAYER
FBComponentFactory.GetComponent<CanvasFacebookLoader>();
#elif UNITY_IOS
FBComponentFactory.GetComponent<IOSFacebookLoader>();
#elif UNITY_ANDROID
FBComponentFactory.GetComponent<AndroidFacebookLoader>();
#else
throw new NotImplementedException("Facebook API does not yet support this platform");
#endif
isInitCalled = true;
return;
}
不,我正在使用它来调用Init。
FB.Init(OnInitComplete, OnHideUnity,null);
然后当我尝试使用此代码发送请求时
public static function SendLifeBack(){
FB.AppRequest
(
"Enjoy a free Potion",
["USER_ID"],
null,
null,
null,
"life",
"Free Life",
LogCallback
);
}
由于没有复选框,因此没有无摩擦请求的迹象 “在向这个用户发送请求之前不要再问我” 即使我将行号10默认为
FBSettings.FrictionlessRequests
即使这样它也无法正常工作。我也检查了FBSettings中的无摩擦复选框。