Firebase 2.5.1を使用しているmacOS Swiftプロジェクトで作業しています。基本的にCRUDシステムです。Swift Firebase:同じ注文例外を持つキーを作成できません
データパスをchildWithAutoIDからカスタム文字列に変更したのは、重複したエントリを避けたいからです。
この新しいパス(約5000エントリ)で、すべてのデータをFirebaseにアップロードしました。私はすべての値を照会しかし、もし、私がexepectionを得る
//Constants.booksFirebase equals my parent path of Firebase
Constants.booksFirebase.queryOrderedByChild("rentedCount").queryLimitedToLast(10).observeEventType(.Value, withBlock: { snap in
let results = snap.value as? NSDictionary
if let results = results {
self.books = []
for obj in results {
let id = obj.key as! String
self.books.append(id)
}
}
})
:「同じ順序付けを持つキーでFImmutableSortedDictionaryを作成することはできません!」私は、次のコードでそれを取得することができます。私はそれを照会方法は、制限なしで、上記の例とまったく同じである:Constants.booksFirebase.queryOrderedByChild("rentedCount").observeEventType(.Value, withBlock:{...}
奇妙なことは、私は別の上記と同じロジックで動作し、他の経路からのデータのセット、Constants.peopleFirebase
が、doesnの」を持っているということです例外は発生しません。
私はFirebaseが同じキーを持つ2つのオブジェクトをアップロードしている可能性があると考えましたが、単なる仮説です。
このエラーは何を意味していますか?
私はこれを見てきましたが、それは私を助けていない: Firebase: Can't create FImmutableSortedDictionary with keys with same ordering
おかげで、 マルセロ
完全なエラーを下回っ:
2016-08-29 21:42:00.846 ProSaber[16218:19613620] An uncaught exception was raised
2016-08-29 21:42:00.846 ProSaber[16218:19613620] Can't create FImmutableSortedDictionary with keys with same ordering!
2016-08-29 21:42:00.846 ProSaber[16218:19613620] (
0 CoreFoundation 0x00007fff94d934f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff93ec4f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff94dfa4bd +[NSException raise:format:] + 205
3 Firebase 0x00000001001e518f __55+[FTreeSortedDictionary fromDictionary:withComparator:]_block_invoke99 + 143
4 CoreFoundation 0x00007fff94d0dc36 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 134
5 CoreFoundation 0x00007fff94d0dac9 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 217
6 Firebase 0x00000001001e4fbc +[FTreeSortedDictionary fromDictionary:withComparator:] + 315
7 Firebase 0x00000001001dd774 +[FImmutableSortedDictionary fromDictionary:withComparator:] + 105
8 Firebase 0x00000001001f67b1 +[FSnapshotUtilities internalNodeFrom:priority:withValidationFrom:atDepth:path:] + 1665
9 Firebase 0x00000001001f60ea +[FSnapshotUtilities nodeFrom:priority:withValidationFrom:atDepth:path:] + 120
10 Firebase 0x00000001001f602e +[FSnapshotUtilities nodeFrom:priority:withValidationFrom:] + 147
11 Firebase 0x00000001001f5f29 +[FSnapshotUtilities nodeFrom:priority:] + 55
12 Firebase 0x00000001002186d1 -[FRepo onDataUpdate:forPath:message:isMerge:tagId:] + 672
13 Firebase 0x000000010022212a -[FPersistentConnection onDataPushWithAction:andBody:] + 591
14 Firebase 0x000000010021eed3 -[FPersistentConnection onDataMessage:withMessage:] + 709
15 Firebase 0x000000010023bd75 -[FConnection onDataMessage:] + 116
16 Firebase 0x000000010023bcac -[FConnection onMessage:withMessage:] + 282
17 Firebase 0x000000010023add0 -[FWebSocketConnection appendFrame:] + 360
18 Firebase 0x000000010023ae8b -[FWebSocketConnection handleIncomingFrame:] + 132
19 Firebase 0x000000010023679f __31-[FSRWebSocket _handleMessage:]_block_invoke + 129
20 libdispatch.dylib 0x0000000100993070 _dispatch_call_block_and_release + 12
21 libdispatch.dylib 0x0000000100985cc5 _dispatch_client_callout + 8
22 libdispatch.dylib 0x000000010098b112 _dispatch_queue_drain + 351
23 libdispatch.dylib 0x0000000100992e24 _dispatch_queue_invoke + 557
24 libdispatch.dylib 0x0000000100989dab _dispatch_root_queue_drain + 1226
25 libdispatch.dylib 0x00000001009898a5 _dispatch_worker_thread3 + 106
26 libsystem_pthread.dylib 0x00000001009e8336 _pthread_wqthread + 1129
27 libsystem_pthread.dylib 0x00000001009e5f91 start_wqthread + 13
)
2016-08-29 21:42:00.847 ProSaber[16218:19613620] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't create FImmutableSortedDictionary with keys with same ordering!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff94d934f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff93ec4f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff94dfa4bd +[NSException raise:format:] + 205
3 Firebase 0x00000001001e518f __55+[FTreeSortedDictionary fromDictionary:withComparator:]_block_invoke99 + 143
4 CoreFoundation 0x00007fff94d0dc36 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 134
5 CoreFoundation 0x00007fff94d0dac9 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 217
6 Firebase 0x00000001001e4fbc +[FTreeSortedDictionary fromDictionary:withComparator:] + 315
7 Firebase 0x00000001001dd774 +[FImmutableSortedDictionary fromDictionary:withComparator:] + 105
8 Firebase 0x00000001001f67b1 +[FSnapshotUtilities internalNodeFrom:priority:withValidationFrom:atDepth:path:] + 1665
9 Firebase 0x00000001001f60ea +[FSnapshotUtilities nodeFrom:priority:withValidationFrom:atDepth:path:] + 120
10 Firebase 0x00000001001f602e +[FSnapshotUtilities nodeFrom:priority:withValidationFrom:] + 147
11 Firebase 0x00000001001f5f29 +[FSnapshotUtilities nodeFrom:priority:] + 55
12 Firebase 0x00000001002186d1 -[FRepo onDataUpdate:forPath:message:isMerge:tagId:] + 672
13 Firebase 0x000000010022212a -[FPersistentConnection onDataPushWithAction:andBody:] + 591
14 Firebase 0x000000010021eed3 -[FPersistentConnection onDataMessage:withMessage:] + 709
15 Firebase 0x000000010023bd75 -[FConnection onDataMessage:] + 116
16 Firebase 0x000000010023bcac -[FConnection onMessage:withMessage:] + 282
17 Firebase 0x000000010023add0 -[FWebSocketConnection appendFrame:] + 360
18 Firebase 0x000000010023ae8b -[FWebSocketConnection handleIncomingFrame:] + 132
19 Firebase 0x000000010023679f __31-[FSRWebSocket _handleMessage:]_block_invoke + 129
20 libdispatch.dylib 0x0000000100993070 _dispatch_call_block_and_release + 12
21 libdispatch.dylib 0x0000000100985cc5 _dispatch_client_callout + 8
22 libdispatch.dylib 0x000000010098b112 _dispatch_queue_drain + 351
23 libdispatch.dylib 0x0000000100992e24 _dispatch_queue_invoke + 557
24 libdispatch.dylib 0x0000000100989dab _dispatch_root_queue_drain + 1226
25 libdispatch.dylib 0x00000001009898a5 _dispatch_worker_thread3 + 106
26 libsystem_pthread.dylib 0x00000001009e8336 _pthread_wqthread + 1129
27 libsystem_pthread.dylib 0x00000001009e5f91 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
こんにちはマシュー、私はそれがそれに関連しているとは思わない。 '' Constants.booksFirebase.observeEventType(.Value、withBlock:{...} '' ')を使用してすべての項目を照会すると、同じエラーが発生します –
質問がなければ、あなたは正しいと思いますそれは重複しているキーであるか、アップロード階層に問題がありますか?大きなデータセットを削除して、小さなセットをアップロードして同じことが起こったことがありますか? – matthew
私は小さなデータセットをアップロードしようとしました。データポイント。私は1000をアップロードしたとき、それは働いたが、2000年はクラッシュを再現するのに十分だった。私は禁止されているすべての文字を削除+無駄をアップロードしていないことを確認して、私が推測しているのは、同じ値を持つ2つのキーがアップロードされていて、そのうちの1つが完全に受け入れられた可能性があるということです私はいくつかのテストをしてからもっと話します。 –