我正在尝试使用 facebook-java-sdk 创建广告
val adCreative = new AdAccount(ACCOUNT_ID, context).createAdCreative()
.setName(s"Test Creative +$TEST")
.setObjectStorySpec(
new AdCreativeObjectStorySpec()
.setFieldLinkData(
new AdCreativeLinkData()
.setFieldCaption("http://www.field-caption.com")
.setFieldImageHash(attachment1.getFieldImageHash)
.setFieldLink("http://www.google.co.in")
.setFieldMessage("try it out")
)
.setFieldPageId(FACEBOOK_PAGE)
)
.execute()
val ad = new AdAccount(ACCOUNT_ID, context).createAd()
.setName(s"Test Ad +$TEST")
.setAdsetId(adSet.getId)
.setCreative(adCreative.getId)
.setCreative(new AdCreative().setFieldId(adCreative.getId()))
.setStatus(Ad.EnumStatus.VALUE_PAUSED)
.execute()
但是 createAd 调用失败并导致异常
com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":1772103,"is_transient":false,"error_user_title":"Instagram Account Is Missing","error_user_msg":"You're using Instagram as a placement. Please select an Instagram account to represent your business in your Instagram ads, or select a Facebook Page to use instead.","fbtrace_id":"FtpWRXVY1tH"}}
几天前这工作正常,但突然开始抛出异常。任何帮助将不胜感激。
最佳答案
我想补充这个答案,因为我刚刚解决了这个问题。
我们长期运行的管理提升的应用程序本月刚刚停止工作,并抛出了OP提到的错误。
Facebook 这边的默认设置似乎发生了变化。 docs state默认值为 facebook、audience_network、messenger
在广告管理器中查看,显示失败的提升尝试的展示位置现在包含 Instagram 作为展示位置。在我能找到的任何地方似乎都没有提及此更改。
因此,我确实必须更改调用以显式定义 facebook、audience_network、messenger
作为我的 publisher_platform setting并且不依赖默认值。
关于facebook-java-sdk 无法创建 "Ad",表示在不真正使用任何东西时使用 instagram a/c 作为放置位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49621778/