Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
714 views
in Technique[技术] by (71.8m points)

javascript - forge.facebook.ui callback invoked with null on iOS

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"}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...