質問編集履歴

4

追記

2017/08/24 02:28

投稿

meamea
meamea

スコア15

test CHANGED
@@ -1 +1 @@
1
- Monaca+NiftyCloudMobileBackendでのデータストアの項目取得について
1
+ Monaca+NiftyCloudMobileBackendでのデータストア内installationクラスの項目取得+端末の項目(バッジ)更新
test CHANGED
@@ -137,3 +137,53 @@
137
137
  cannot GET https://mb.api.cloud.nifty.com/2013-09-01/classes/installation(403)
138
138
 
139
139
  ```
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ ### 追記2
148
+
149
+ 最終的にプッシュ通知のバッジ初期化まで解決できたため記述しておきます。
150
+
151
+ 同時にタイトルも変更いたしました。
152
+
153
+
154
+
155
+ ```js
156
+
157
+ document.addEventListener("resume", function(){
158
+
159
+ setTimeout(function() {
160
+
161
+ clearNCMBbadge();
162
+
163
+ }, 0);
164
+
165
+ }, false);
166
+
167
+ document.addEventListener("deviceready", clearNCMBbadge(), false);
168
+
169
+
170
+
171
+ function clearNCMBbadge(){
172
+
173
+ var ncmb = new NCMB(MOBILE_BACKEND_APPLICATION_KEY, MOBILE_BACKEND_CLIENT_KEY);
174
+
175
+ var Installation = ncmb.Installation;
176
+
177
+ var installation = new Installation();
178
+
179
+ installation.objectId = localStorage.getItem("USER_OBJECT_ID");
180
+
181
+ installation.badge = 0;
182
+
183
+
184
+
185
+ return installation.update(function(){alert('更新完了');});
186
+
187
+ }
188
+
189
+ ```

3

追記1追加

2017/08/24 02:28

投稿

meamea
meamea

スコア15

test CHANGED
File without changes
test CHANGED
@@ -119,3 +119,21 @@
119
119
  installation取得に失敗しましたcannot GET https://mb.api.cloud.nifty.com/2013-09-01/classes/installation/XWSTB%EF%BD%8DFx70EkKrlj
120
120
 
121
121
  ```
122
+
123
+
124
+
125
+
126
+
127
+ ### 追記1
128
+
129
+ NCMBのデータストアにはデータの登録はされています。
130
+
131
+ (ダッシュボードの解釈違いでしたら申し訳ありません・・・)
132
+
133
+ fetchAllを実行した場合、下記エラーメッセージが発生しました
134
+
135
+ ```
136
+
137
+ cannot GET https://mb.api.cloud.nifty.com/2013-09-01/classes/installation(403)
138
+
139
+ ```

2

エラーメッセージ追加

2017/08/21 09:00

投稿

meamea
meamea

スコア15

test CHANGED
File without changes
test CHANGED
@@ -109,3 +109,13 @@
109
109
  }
110
110
 
111
111
  ```
112
+
113
+
114
+
115
+ ###エラーメッセージ
116
+
117
+ ```
118
+
119
+ installation取得に失敗しましたcannot GET https://mb.api.cloud.nifty.com/2013-09-01/classes/installation/XWSTB%EF%BD%8DFx70EkKrlj
120
+
121
+ ```

1

一部追記

2017/08/21 07:51

投稿

meamea
meamea

スコア15

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,17 @@
32
32
 
33
33
  ###該当のソースコード
34
34
 
35
+
36
+
37
+ ※2通りの記述を書いています
38
+
39
+
40
+
41
+
42
+
35
43
  ```ここに言語を入力
44
+
45
+ function clearNCMBbadge(){
36
46
 
37
47
  var ncmb = new NCMB(MOBILE_BACKEND_APPLICATION_KEY, MOBILE_BACKEND_CLIENT_KEY);
38
48
 
@@ -96,4 +106,6 @@
96
106
 
97
107
  });
98
108
 
109
+ }
110
+
99
111
  ```