我想要获取 Facebook 的应用程序用户 ID,如下所述: https://developers.facebook.com/docs/ads-for-apps/custom-audiences-for-mobile-apps/
他们给出的代码片段是:
[FBRequestConnection startForCustomAudienceThirdPartyID:nil
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSString *id = error ? nil : [result objectForKey:@"custom_audience_third_party_id"];
// Stash off this id, send it to your server, etc. Use later to construct
// a custom audience. A result of 'nil' means that either the user can't be
// identified, or they've limited ad tracking via iOS 6.
}
];
这总是为我返回错误 400。答案如 this建议将其用作更大代码段的一部分,但 Facebook 页面上没有提及这一点。
我可以只使用上面的代码片段,还是需要围绕它实现一些东西?
最佳答案
我从 FB 开发者页面得到这个:
讨论: 如果 <[FBSettings defaultAppID]> 或 <[FBSettings clientToken]> 为零,此方法将抛出异常。当 pList 包含 appID 或明确设置时,appID 不会为 nil。 clientToken 需要通过 <[FBSettings setClientToken:]> 设置。
.....
请先检查以上条件。根据文档评估
startForCustomAudienceThirdPartyID: -> should actually point to the current FBSession
关于ios - FBRequestConnection startForCustomAudienceThirdPartyID 可以单独使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20529710/