3

在使用 PDK 的 createPin() 方法为 Android 应用创建新引脚时,

public void createPin(String note, String boardId, String imageUrl, String link, PDKCallback callback)

它抛出错误代码 400 的错误响应,没有正确的错误消息。下面是我一直在使用的代码。

String note = "Hello World!";
String boardID = "130323051656269527";
String imgURL = "https://www.instagram.com/p/BXB_J-mld0Z/?taken-by=chelseasmakeup";
PDKClient.getInstance().createPin(note, boardID, imgURL,null,
                    new PDKCallback() {
                        @Override
                        public void onSuccess(PDKResponse response) {
                            Log.e("TAG", "response: " + response.toString());
                        }

                        @Override
                        public void onFailure(PDKException exception) {
                            exception.printStackTrace();
                        }
                    });

boardID 没有任何磨损,因为具有相同 boardID 的其他 api 工作正常。只是创建新引脚失败。我找不到这个的解决方案。

这是日志

PDK POST: https://api.pinterest.com/v1/pins/ 
BasicNetwork.performRequest: Unexpected response code 400 for https://api.pinterest.com/v1/pins/?access_token=AX4CNtTbNh5ftBz7W1gIcr8gpNFQFNW6RGIDvLtEMpH7NmBEFgAAAAA

com.pinterest.android.pdk.PDKException
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.pinterest.android.pdk.PDKCallback.onErrorResponse(PDKCallback.java:28)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.volley.Request.deliverError(Request.java:598)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:101)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Looper.loop(Looper.java:154)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6077)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
07-29 12:19:35.321 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
07-29 12:19:35.321 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
4

1 回答 1

1

换行

if (!Utils.isEmpty(link)) params.put("image_url", imageUrl);

if (!Utils.isEmpty(imageUrl);)) params.put("image_url", imageUrl);

稍后当您传递图像 URL 时,请确保 URL 具有类似“ http://goldwallpapers.com/uploads/posts/blue-tiger-wallpaper/blue_tiger_wallpaper_001.jpg ”的扩展名。像“ https://www.instagram.com/p/BUAs-jVF9Fx/?taken-by=chelseasmakeup ”这样的 URL不起作用。

于 2017-07-31T06:48:36.670 回答