gpt4 book ai didi

android : Error com. parse.ParseException : at least one ID field (installationId, deviceToken) 必须在此操作中指定

转载 作者:可可西里 更新时间:2023-11-01 19:05:42 25 4
gpt4 key购买 nike

我在我们的应用程序中使用推送通知解析,但在设备注册时出现一些问题,错误如下所示。还有一个问题,当我们向设备发送推送通知时,设备会收到多个通知。尽管我们也已将解析库升级到 Parse 1.4.1。请帮助我,在此先感谢。

错误 首次安装应用程序时显示:

04-14 14:00:40.004: E/LOG(26045): Socket event: onConnect 
04-14 14:00:41.874: E/ParseCommandCache(26045): Failed to run command.
04-14 14:00:41.874: E/ParseCommandCache(26045): com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.ParseCommand$2.then(ParseCommand.java:348)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.continueWith(Task.java:322)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.continueWith(Task.java:333)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$8.then(Task.java:385)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$8.then(Task.java:377)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11.run(Task.java:485)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.completeAfterTask(Task.java:481)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$300(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$7.then(Task.java:350)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$7.then(Task.java:347)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11$1.then(Task.java:497)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11$1.then(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$200(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$6.then(Task.java:315)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$6.then(Task.java:312)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11$1.then(Task.java:497)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11$1.then(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.continueWith(Task.java:322)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.continueWith(Task.java:333)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$11.run(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.completeAfterTask(Task.java:481)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$300(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$7.then(Task.java:350)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$7.then(Task.java:347)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045): at com.parse.Task$3.run(Task.java:228)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-14 14:00:41.874: E/ParseCommandCache(26045): at java.lang.Thread.run(Thread.java:841)

更新代码

    Parse.initialize(this, Constant.PARSE_APP_ID, Constant.PARSE_CLIENT_KEY);
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().getInstallationId();
ParseInstallation.getCurrentInstallation().saveInBackground();

这是我在 parse.com 上注册时使用的代码

   PushService.subscribe(this, "name",Detail.class);

这是我用来注册 channel 的代码

最佳答案

同样的问题。
这对我来说像是一个竞争条件,所以我尝试将 setDefaultPushCallback 放入新的回调中,如下所示:

ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback()
{
@Override
public void done(ParseException e)
{
PushService.setDefaultPushCallback(ParseApplication.this, ParseStarterProjectActivity.class);
}
});

我还没有崩溃(虽然时间不长)。我希望这会有所帮助。

关于android : Error com. parse.ParseException : at least one ID field (installationId, deviceToken) 必须在此操作中指定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23057865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com