facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
AppRequest response always has Canceled == true on SDK >= 9.0.0 on iOS
Checklist
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing GitHub issues
- [X] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [X] I've read the Code of Conduct
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
- Unity Editor Version:
2020.3.7f1
- Unity SDK Version:
9.2.0
- Installation Platform & Version:
[iOS]
version14.5.0
and '12.5.2' and probably anywhere inbetween
Goals
Be able to invite friends and send app requests with Unity FB SDK 9.2.0
Expected Results
After the AppRequest call is made, the callback is called with no Error and Cancelled == false
Actual Results
Calls to FB.AppRequest work on Android, but always return Cancelled == true on iOS
Steps to Reproduce
Login with SDK 9.2.0, then make a call to Invite friends (filter : "app_non_users") or friends already playing (filter : null) - the callback is called in both cases with .Cancelled == true.
Code Samples & Details
NOTE: this works perfectly fine on SDK 8.1.1 - this code is live on our app and I can guarantee that the only think I have changed is the SDK that now is 9.2.0 - and suddenly it does not work anymore. If I rollback to 8.1.1 it works again. On Android instead it always works.
// Invite
FB.AppRequest(
"Come play this game!",
null,
new List<object>() { "app_non_users" },
null,
null,
"Some Data", // data, max 255 chars
"The Game",
OnResponseCallback);
// Ask for
List<string> kFacebookIds = new List<string>() { "12345", "67890"};
FB.AppRequest(
"Give me a life!",
kFacebookIds,
null,
null,
null,
"Some Data", // data, max 255 chars
"Life request",
OnResponseCallback);
private void OnResponseCallback(Facebook.Unity.IAppRequestResult kResult)
{
if (string.IsNullOrEmpty(kResult.Error) && !kResult.Cancelled)
{
// Good
}
else
{
// Bad - on 9.2.0 I always get here because kResult.Cancelled == true
}
}
Same issue, did you fixed it?
Same issue. The link above doesn't resolve it. Facebook continues to cancel all iOS AppRequests. Android is working fine. Anyone know how to fix? Unity: 2020.3.13f1 Facebook: V11.0
We noticed this issue when we try to do ShareLink on iOS and always receive {"callback_id":"3","cancelled":"true"} as a result. This is happening with Facebook SDK 9.0 but it only started happening when we updated Unity from 2019.1.14 to 2020.3.11.
We have also run into this issue when attempting to upgrade from v9.0 to v11.0.
Looking into it a bit further, what I have found is that in the change log of the iOS SDK there is the following entry for v9.3:
GamingServicesKit changed the Game Request feature flow where if the user has the facebook app installed, they will not see a webview to complete a game request. Instead they will switch to the facebook app and app switch back once the request is sent or the user cancels the dialog.
I suspect that this is the change that ultimately broke the Unity Plugin.
To support this theory, we tried updating the plugin to v9.2 and then altered the Dependencies.xml file to explicitely use v9.2.0 of the underyling native iOS SDK:
After these changes we once again started receiving the expected data in our AppRequest callback.
While we would prefer to be able to update directly to v11 of the plugin, this will at least tide us over until a workaround can be identified or a new version is released with a proper fix.
Same issue, we use FB iOS 11.x.0 , the fix is in the following file, the variable BOOL cancelled need to assign default NO
In FBSDKCoreKit/FBSDKCoreKit/FBSDKBridgeAPIResponse.m
+ (instancetype)bridgeAPIResponseWithRequest:(NSObject<FBSDKBridgeAPIRequestProtocol> *)request
responseURL:(NSURL *)responseURL
sourceApplication:(NSString *)sourceApplication
osVersionComparer:(id<FBSDKOperatingSystemVersionComparing>)comparer
error:(NSError *__autoreleasing *)errorRef
{
...
BOOL cancelled = NO; // it should assign default value NO
NSError *error;
NSDictionary *responseParameters = [protocol responseParametersForActionID:request.actionID
queryParameters:queryParameters
cancelled:&cancelled
error:&error];
...
@psstevenchan Thank you so much! Since last game update, AppRequests was totally broken on iOS, now it seems to work as usual. @facebook-unity-team This really have to be fixed, you ask us to upgrade the SDK but after the upgrade thinks don't work anymore. All Facebook SDK update is a real nightmare !
So, sorry, what's the actual fix for this issue? I have upgraded iOS FBSDK to 13 and on GameRequestDialog show() still nothings happens.
@fabioacri81 In FBSDKCoreKit/FBSDKCoreKit/FBSDKBridgeAPIResponse.m
+ (instancetype)bridgeAPIResponseWithRequest:
{
...
BOOL cancelled;
Set cancelled = NO;