forge.facebook.ui callback invoked with null on iOS

天涯浪子 提交于 2019-11-28 09:08:01

问题


I'm having trouble with Trigger.io Forge and getting a callback from a native FB friend selector UI. The problem is only showing on iOS, works fine on Android.

Running this code in catalyst on either iPhone device or simulator causes the FB dialogue to show correctly.

>forge.facebook.ui({
        method: 'apprequests',
        message: 'Hey'
    }, function(a){console.log('success: '+JSON.stringify(a))}, function(error) {console.log('error:'+JSON.stringify(error))});
>undefined
>success: null

When selecting some users and sending the requests the dialogue closes, but the callback is never called. The following shows up in Forge debug log:

[DEBUG] Native call: {
[DEBUG]     callid = "35938A56-CEEC-44E1-8742-889D273F6E9E";
[DEBUG]     method = "facebook.ui";
[DEBUG]     params =     {
[DEBUG]         "exclude_ids" = "";
[DEBUG]         message = "invited you to play Halo 4";
[DEBUG]         method = apprequests;
[DEBUG]     };
[DEBUG]     start = "1353579502.975";
[DEBUG] }
[DEBUG] Returning to javascript: {
[DEBUG]     callid = "35938A56-CEEC-44E1-8742-889D273F6E9E";
[DEBUG]     content = "<null>";
[DEBUG]     status = success;
[DEBUG] }
[DEBUG] 2012-12-05 13:04:09.631 Forge[5110:c07] An instance 0x9dd3700 of class  FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
[DEBUG] <NSKeyValueObservationInfo 0x9dcad90> (
[DEBUG] <NSKeyValueObservance 0x9dd1300: Observer: 0x9de4680, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x112ad4, Property: 0xc9a6fe0>
[DEBUG] <NSKeyValueObservance 0x9dbba50: Observer: 0x9de4680, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x112ad4, Property: 0xc9a0a60>
[DEBUG] )

We tried Forge version 1.4, 1.4.21, no joy. I presume it is something to do with the callback content = null.

Thanks for your help.

UPDATE James, you are correct - the iPhone callback is getting called, but the response is always null. I am expecting to receive an object with FB user IDs and request IDs.

For reference, Android is working correctly, and returns:

[DEBUG] Native call "facebook.ui" with task.params: {"method":"apprequests","message":"Hey"}
[DEBUG] Returning: {"content":{"to[0]":"100004602392907","request":"453015091412347",
                                   "to[1]":"515252483"},
                                    "status":"success",
                                    "callid":"ED47AAB4-7A72-45A0-B0B3-0DADC9A75E9C"}

And if the user cancels the FB dialogue this is returned:

[DEBUG] Returning: {"content":{},"status":"success",
                        "callid":"256CB78F-3EE1-4BD7-8990-EDE26275D68F"}

回答1:


A fix for this will be included in v1.4.23 Trigger.io platform version.

Your success callback will be invoked with (for apprequests for example):

{"request":"519074534448448","to[0]":"105000524002524"}

Note: your success callback will still be invoked if the user hits cancel: {} will be passed as the callback parameter.

If they hit the x in the top-left corner, your failure callback will be invoked.



来源:https://stackoverflow.com/questions/13516726/forge-facebook-ui-callback-invoked-with-null-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!