热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

解析:ACL无法向服务器发送数据-Parse:ACLCannotsenddatatoserver

Helloguysihaveproblemwherecannotsenddatatoserver.Atfirstitrysendingdatabywrite(Par

Hello guys i have problem where cannot send data to server.At first i try sending data by write (ParseObject) at StarterApplication.java and it work.but when write (ParseObject) at MainActivity.java and not work.Why?.Hope you guys can help me solve this problem.TQ

大家好我有问题哪里不能发送数据到服务器。首先我尝试通过写入(ParseObject)在StarterApplication.java发送数据,它工作。但是当在MainActivity.java写入(ParseObject)而不工作。为什么?。希望你伙计们可以帮我解决这个问题.TQ

ERROR MESSAGE ERROR

错误信息

LOGCAT

logcat的

  05-17 15:03:28.128 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.4.0_301a24434564d06ffe12a56ff7da00f52e346cb8-classes.dex
    05-17 15:03:28.132 1735-2020/com.parse.starter I/art: jiangtaottt DexFile_ThirdDex2oatNative 222/data/data/com.parse.starter/files/instant-run/dex/slice-com.google.android.gms-play-services-ads-9.4.0_51356d099b9793fc820c0bb434ab4f81fcffdbec-classes.dex
    05-17 15:03:28.133 1735-2020/com.parse.starter I/art: jiangtaottt get_parent_dir: parent: /data/data/com.parse.starter  i=28
    05-17 15:03:28.133 1735-2020/com.parse.starter I/art: jiangtaottt DexFile_ThirdDex2oatNative is dexing   /data/data/com.parse.starter/dexing-flag
    05-17 15:03:28.142 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.4.0_301a24434564d06ffe12a56ff7da00f52e346cb8-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.4.0_301a24434564d06ffe12a56ff7da00f52e346cb8-classes.dex
    05-17 15:03:28.143 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_48aa21b4e8403c1677e9ab895231d93ecfe54c25-classes.dex
    05-17 15:03:28.155 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_48aa21b4e8403c1677e9ab895231d93ecfe54c25-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_48aa21b4e8403c1677e9ab895231d93ecfe54c25-classes.dex
    05-17 15:03:28.156 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_3727344502c75ae6bc14c2f0efce22a2f915d89d-classes.dex
    05-17 15:03:28.253 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_3727344502c75ae6bc14c2f0efce22a2f915d89d-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_3727344502c75ae6bc14c2f0efce22a2f915d89d-classes.dex
    05-17 15:03:28.259 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-mediarouter-v7-23.0.0_2ef8fc2a0c6a2fe4d1d819e09cfdd1e223aceadd-classes.dex
    05-17 15:03:28.344 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-mediarouter-v7-23.0.0_2ef8fc2a0c6a2fe4d1d819e09cfdd1e223aceadd-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-mediarouter-v7-23.0.0_2ef8fc2a0c6a2fe4d1d819e09cfdd1e223aceadd-classes.dex
    05-17 15:03:28.345 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.4.0_7c9c4c583792bd7fa91047936d492183a0729810-classes.dex
    05-17 15:03:28.452 1735-2006/com.parse.starter I/art: jiangtaottt DexFile_ThirdDex2oatNative success 333/data/data/com.parse.starter/files/instant-run/dex/slice-com.google.android.gms-play-services-analytics-9.4.0_d335cf156da033164f9e20361a0eb22e92eec4ae-classes.dex
    05-17 15:03:28.458 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.4.0_7c9c4c583792bd7fa91047936d492183a0729810-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.4.0_7c9c4c583792bd7fa91047936d492183a0729810-classes.dex
    05-17 15:03:28.460 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.4.0_e295f74e431be9c2235019e0b34f4458989a4df7-classes.dex
    05-17 15:03:28.479 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.4.0_e295f74e431be9c2235019e0b34f4458989a4df7-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.4.0_e295f74e431be9c2235019e0b34f4458989a4df7-classes.dex
    05-17 15:03:28.480 1735-1735/com.parse.starter I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/data/com.parse.starter/files/instant-run/dex/slice-bolts-tasks-1.4.0_e967602cedb3cdf27c5916205188b8064fdde338-classes.dex
    05-17 15:03:28.487 1735-1735/com.parse.starter E/System: elements.add : /data/data/com.parse.starter/files/instant-run/dex/slice-bolts-tasks-1.4.0_e967602cedb3cdf27c5916205188b8064fdde338-classes.dex  null   /data/data/com.parse.starter/files/instant-run/dex/slice-bolts-tasks-1.4.0_e967602cedb3cdf27c5916205188b8064fdde338-classes.dex
    05-17 15:03:28.556 1735-1755/com.parse.starter W/art: Suspending all threads took: 8.438ms
    05-17 15:03:28.559 1735-1755/com.parse.starter I/art: Background sticky concurrent mark sweep GC freed 1108(304KB) AllocSpace objects, 14(352KB) LOS objects, 33% free, 1419KB/2MB, paused 9.975ms total 21.194ms
    05-17 15:03:28.613 1735-1735/com.parse.starter I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
    05-17 15:03:28.763 1735-1750/com.parse.starter W/art: Suspending all threads took: 9.527ms
    05-17 15:03:29.212 1735-1735/com.parse.starter D/wangcy9: setStatusIcon occur wrong theme!
    05-17 15:03:29.361 1735-1735/com.parse.starter W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    05-17 15:03:29.627 1735-1735/com.parse.starter I/ViewRootImpl: CPU Rendering VSync enable = true
    05-17 15:03:29.647 1735-2096/com.parse.starter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    05-17 15:03:29.657 1735-1735/com.parse.starter D/Atlas: Validating map...
    05-17 15:03:29.703 1735-2096/com.parse.starter I/Adreno-EGL: : EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8916_64_LA.BR.1.2.4_RB1__release_AU (Ibddc658e36)
                                                                 OpenGL ES Shader Compiler Version: E031.25.03.04
                                                                 Build Date: 09/08/15 Tue
                                                                 Local Branch: 
                                                                 Remote Branch: quic/LA.BR.1.2.4_rb1.17
                                                                 Local Patches: NONE
                                                                 Reconstruct Branch: NOTHING
    05-17 15:03:29.705 1735-2096/com.parse.starter I/OpenGLRenderer: Initialized EGL, version 1.4
    05-17 15:03:29.722 1735-2096/com.parse.starter D/OpenGLRenderer: Enabling debug mode 0
    05-17 15:03:29.733 1735-2096/com.parse.starter I/qdutils: PartialUpdate status: Disabled
    05-17 15:03:29.733 1735-2096/com.parse.starter I/qdutils: Left Align: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Width Align: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Top Align: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Height Align: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Min ROI Width: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Min ROI Height: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Needs ROI Merge: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Dynamic Fps: Disabled
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Min Panel fps: 0
    05-17 15:03:29.734 1735-2096/com.parse.starter I/qdutils: Max Panel fps: 0
    05-17 15:03:29.854 1735-1735/com.parse.starter I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@702c751 time:367176349
    05-17 15:03:31.168 1735-1735/com.parse.starter I/SaveInBackground: Failed.Errorcom.parse.ParseRequest$ParseRequestException: Invalid ACL.

StarterApplication.java

StarterApplication.java

/*
 * Copyright (c) 2015-present, Parse, LLC.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
package com.parse.starter;

import android.app.Application;
import android.util.Log;

import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.SaveCallback;


public class StarterApplication extends Application {

  @Override
  public void onCreate() {
    super.onCreate();

    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    // Add your initialization code here
    Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
            .applicationId("appID")
            .clientKey("ClientKey")
            .server("url")
            .build()
    );
  /*
    ParseObject object = new ParseObject("ExampleObject");
    object.put("myNumber", "123");
    object.put("myString", "rob");

    object.saveInBackground(new SaveCallback () {
      @Override
      public void done(ParseException ex) {
        if (ex == null) {
          Log.i("Parse Result", "Successful!");
        } else {
          Log.i("Parse Result", "Failed" + ex.toString());
        }
      }
    });

      */

    ParseUser.enableAutomaticUser();

    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);

  }
}

MainActivity.java

MainActivity.java

/*
 * Copyright (c) 2015-present, Parse, LLC.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
package com.parse.starter;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Switch;

import com.parse.LogInCallback;
import com.parse.Parse;
import com.parse.ParseAnalytics;
import com.parse.ParseAnonymousUtils;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.SaveCallback;


public class MainActivity extends AppCompatActivity {


  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

      //create object  = Score
      ParseObject score = new ParseObject("Score");
      score.put("username","michael");
      score.put("score",40);
      score.saveEventually(new SaveCallback() {
          @Override
          public void done(ParseException e) {
              if(e == null){
                  Log.i("SaveInBackground","Successfully");
              }else{
                  Log.i("SaveInBackground","Failed.Error"+e.toString());
              }
          }
      });

    ParseAnalytics.trackAppOpenedInBackground(getIntent());
  }

}

1 个解决方案

#1


1  

Please remove

请删除

ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);

推荐阅读
  • 本文详细介绍了如何解决在使用本地SQlyog客户端尝试连接阿里云上的MariaDB数据库时遇到的2003错误,即无法连接到MySQL服务器的问题。 ... [详细]
  • 本文探讨了如何利用 Application 对象在 PHP 应用程序中共享数据,特别是在多用户环境中保持数据的一致性和安全性。文章还介绍了 Application 对象的基本结构、方法和事件,并提供了实际应用示例。 ... [详细]
  • Oracle中打开10046Trace的各种方法10046trace的跟踪等级10046是一个Oracle的内部事件(event),通过设置这个事件可以得到Oracl ... [详细]
  • 理解HTTP状态码及其应用
    本文详细解析了HTTP状态码的分类及常见代码的意义,帮助开发者和用户更好地理解和解决网络请求中遇到的问题。 ... [详细]
  • 这个报错出现在userDao里面,sessionfactory没有注入。解决办法:spring整合Hibernate使用test测试时要把spring.xml和spring-hib ... [详细]
  • J2EE平台集成了多种服务、API和协议,旨在支持基于Web的多层应用开发。本文将详细介绍J2EE平台中的13项关键技术规范,涵盖从数据库连接到事务处理等多个方面。 ... [详细]
  • 本文通过对OkHttp源码的详细解读,旨在帮助读者理解其核心执行流程,特别是同步与异步请求的处理方式。文中不仅涵盖了基本的使用示例,还深入探讨了OkHttp的核心功能——拦截器链的工作原理。 ... [详细]
  • JobScheduler5.0源码分析
    0.JobScheduler执行代码mJobScheduler(JobScheduler)getSystemService(Context.JOB_SCHEDULER_SERVICE); ... [详细]
  • 解决MySQL Administrator 登录失败问题
    本文提供了解决在使用MySQL Administrator时遇到的登录错误的方法,包括启动变量和服务部分禁用的问题。同时,文章还介绍了通过安全配置模式来解决问题的具体步骤。 ... [详细]
  • 本文详细介绍了使用Apache的AB工具和Webbench进行服务器性能测试的过程,分享了实际操作中的测试结果,并探讨了测试过程中遇到的问题及可能的解决方案。 ... [详细]
  • 深入理解SAP Fiori及其核心概念
    本文详细介绍了SAP Fiori的基本概念、发展历程、核心特性、应用类型、运行环境以及开发工具等,旨在帮助读者全面了解SAP Fiori的技术框架和应用场景。 ... [详细]
  • Apollo入门指南
    Apollo是一个分布式配置中心,由服务端和客户端组成,支持配置的集中管理和动态更新。 ... [详细]
  • 本文详细介绍了如何在阿里云 ECS 实例上安装和配置 MySQL 数据库,包括安装 MySQL 的 Yum 仓库、解决常见安装问题、启动服务以及设置初始用户权限等步骤。 ... [详细]
  • 本文介绍了在Linux系统中如何使用不同的命令和工具来查看和检查端口状态,包括有权限和无权限情况下的操作方法。 ... [详细]
  • 本文详细介绍如何在Spring Boot项目中集成和使用JPA,涵盖JPA的基本概念、Spring Data JPA的功能以及具体的操作步骤,帮助开发者快速掌握这一强大的持久化技术。 ... [详细]
author-avatar
栋哥0822_893
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有