我在使用 Trigger.io Forge 并从本机 FB 好友选择器 UI 获取回调时遇到问题。该问题仅在 iOS 上显示,在 Android 上运行良好。
在 iPhone 设备或模拟器上的催化剂中运行此代码会导致 FB 对话正确显示。
>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
选择某些用户并发送对话请求关闭时,但从未调用回调。Forge 调试日志中显示以下内容:
[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] )
我们尝试了 Forge 版本 1.4、1.4.21,没有任何乐趣。我认为这与回调内容 = null 有关。
谢谢你的帮助。
更新 詹姆斯,你是对的 - iPhone 回调被调用,但响应始终为空。我期待收到一个带有 FB 用户 ID 和请求 ID 的对象。
作为参考,Android 工作正常,并返回:
[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"}
如果用户取消 FB 对话,则会返回:
[DEBUG] Returning: {"content":{},"status":"success",
"callid":"256CB78F-3EE1-4BD7-8990-EDE26275D68F"}