【发布时间】:2011-05-18 07:59:20
【问题描述】:
我正在尝试创建测试用户(作品),然后邀请他们加入我的应用程序,以便测试我是否可以检索跟踪数据(在数据字段内)。不幸的是,当我向测试用户发送邀请时,我得到了一个例外:
API 错误代码:2
API 错误说明:服务 暂时不可用
错误信息:暂时服务 不可用
这是我的代码:
<input type="text" value="@ViewBag.TestId" id="theId" />
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '193005690721590',
status : true,
cookie : true,
xfbml : true
});
};
console.log(@ViewBag.TestId);
$('#sendReq').click(sendRequest);
function sendRequest() {
FB.ui({
method: 'apprequests',
message: 'Invitation to the test application!',
title: 'Send your friends an application request',
to: $('#theId').val(),
data: 'someCode'
},
function (response) {
if (response && response.request_ids) {
var requests = response.request_ids.join(',');
$.ajax({
url: '/Home/Parse',
type: 'post',
data: response,
success: function (data) {
if (data.result === 'ok') {
alert("Everything went fine");
//top.location.href = '/Home/About';
}
}
});
} else {
alert('canceled');
}
});
return false;
}
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
} ());
</script>
我的代码正在获取测试用户的正确 ID,然后我尝试发送邀请但没有成功...
有什么想法吗?
【问题讨论】:
-
您是从另一个测试帐户发送请求吗?
-
@echeese:不,我是从我自己的帐户发送的。
-
这可能是你的问题。测试用户和普通用户彼此完全隔离。
-
@echeese:那么您知道如何让一个测试用户邀请另一个测试用户吗?我相信第一个需要已经安装了应用程序......
-
您可以以测试用户身份登录并发出邀请,或者developers.facebook.com/docs/test_users 表示您可以在已安装应用程序的情况下创建测试用户。
标签: javascript facebook api