“未捕获(承诺)未定义”在Facebook Graph API查询中使用with = location时出错 [英] "Uncaught (in promise) undefined" error when using with=location in Facebook Graph API query
问题描述
我目前正在使用Facebook Graph API开发Web应用程序。
我目前的目标是仅检索附有位置的帖子。
在检索有和没有位置的帖子已经正常工作时,我无法仅检索位置信息。
查询检索两种类型,如下所示:'/ me / feed?fields = id,name,message,picture,place,with_tags& limit = 100& with = location'
p>
只能检索位置的帖子的查询如下所示: / me / feed?fields = id,name,message,picture,place,with_tags& ; limit = 100& with = location
我遇到的问题是使用参数& with = location
在我的代码的这一部分,我收到错误未保留(承诺)未定义
if(response.paging&& response.paging.next){
recursiveAPICall(response.paging.next);
} else {
resolve(postsArr);
}
} else {
//错误消息来自这里
reject();
}
日志显示以下内容:
调试:-------------------------------
DEBUG:Ember:2.4.5
DEBUG:Ember数据:2.5.3
DEBUG:jQuery:2.2.4
DEBUG:Ember Simple Auth:1.1.0
DEBUG: - ------------------------------
Object {error:Object}
错误:Objectcode:
code:1
1fbtrace_id:H5cXMe7TJIn
message:发生未知错误。
类型:OAuthException
__proto__:对象
__proto__:对象
未保留(承诺)未定义
有没有人有可能的解决方案?
有关代码如何看到的详细信息,请参阅我的以前的问题。
错误告诉你有一个错误,但你没有抓住它。这是你如何捕捉到的:
getAllPosts()然后(response => {
console.log (响应);
})。catch(e => {
console.log(e);
});
你也可以把一个 console.log(reponse)
在你的API回调函数的开头,绝对有一个来自Graph API的错误消息。
更多信息: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise/抓住
I am currently developing a web application with the Facebook Graph API.
My current goal is to retrieve only posts which have a location attached.
While retrieving posts with and without location is already working, I am not able to retrieve only posts with location.
The query which retrieves both types looks like this: '/me/feed?fields=id,name,message,picture,place,with_tags&limit=100&with=location'
The query which should retrieve only posts with location looks like this: /me/feed?fields=id,name,message,picture,place,with_tags&limit=100&with=location
The problem I have is that with the parameter &with=location
I get an error Uncaught (in promise) undefined
at this part of my code:
if (response.paging && response.paging.next) {
recursiveAPICall(response.paging.next);
} else {
resolve(postsArr);
}
} else {
// Error message comes from here
reject();
}
Log shows the following:
DEBUG: -------------------------------
DEBUG: Ember : 2.4.5
DEBUG: Ember Data : 2.5.3
DEBUG: jQuery : 2.2.4
DEBUG: Ember Simple Auth : 1.1.0
DEBUG: -------------------------------
Object {error: Object}
error: Objectcode:
code: 1
1fbtrace_id: "H5cXMe7TJIn"
message: "An unknown error has occurred."
type: "OAuthException"
__proto__: Object
__proto__: Object
Uncaught (in promise) undefined
Does anyone have a possible solution for this?
For further information how the code looks like see my previous question.
The error tells you that there is an error but you don´t catch it. This is how you can catch it:
getAllPosts().then(response => {
console.log(response);
}).catch(e => {
console.log(e);
});
You can also just put a console.log(reponse)
at the beginning of your API callback function, there is definitely an error message from the Graph API in it.
More information: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
这篇关于“未捕获(承诺)未定义”在Facebook Graph API查询中使用with = location时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!