UITableView无法填充Firebase数据-断言失败

时间:2019-02-02 14:02:30

标签: ios firebase uitableview google-cloud-firestore

FirebaseUI处理UITableView的方式出现了一个奇怪的问题。似乎在最初加载UITableView时,它无法从Firebase呈现数据。但是,在后续加载中,没有问题。不知道它是否与脱机持久性有关或是否正在缓存数据,但是从本质上来说,在将数据初始加载到UITableView中时,我收到以下错误:

错误:

 <?php
session_start();
include('../connect.php');
$a = $_POST['name'];

 // query

  $file_name  = strtolower($_FILES['file']['name']);
  $file_ext = substr($file_name, strrpos($file_name, '.'));
  $prefix = 'your_site_name_'.md5(time()*rand(1, 9999));
  $file_name_new = $prefix.$file_ext;
  $path = '../uploads/'.$file_name_new;


/* check if the file uploaded successfully */
if(@move_uploaded_file($_FILES['file']['tmp_name'], $path)) {

 //do your write to the database filename and other details   
$sql = "INSERT INTO student (name,file) VALUES (:a,h)";
$q = $db->prepare($sql);
$q->execute(array(':a'=>$a,':h'=>$file_name_new));
header("location: students.php");

}
?>

代码:

    2019-01-27 15:05:24.078515-0600 BetShark[7094:381856] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.93.8/UITableView.m:1776
2019-01-27 15:05:24.094211-0600 BetShark[7094:381856] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to perform an insert and a move to the same index path (<NSIndexPath: 0x8c28b55a1a1eb51c> {length = 2, path = 0 - 78})'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000110f241bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x00000001104ca735 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000110f23f42 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010bbe4877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    4   UIKitCore                           0x000000011906c88a -[UITableView _endCellAnimationsWithContext:] + 9355
    5   UIKitCore                           0x0000000119088711 -[UITableView endUpdates] + 75
    6   BetShark                            0x0000000107c09405 -[FUIFirestoreTableViewDataSource batchedArray:didUpdateWithDiff:] + 3285
    7   BetShark                            0x0000000107bf9906 __31-[FUIBatchedArray observeQuery]_block_invoke + 1094
    8   BetShark                            0x000000010796a628 __60-[FIRQuery addSnapshotListenerInternalWithOptions:listener:]_block_invoke + 456
    9   BetShark                            0x000000010797d495 _ZZZ45-[FSTAsyncQueryListener asyncSnapshotHandler]EUb_ENK3$_0clEv + 85
    10  BetShark                            0x000000010797d42d _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZZ45-[FSTAsyncQueryListener asyncSnapshotHandler]EUb_E3$_0EEEvDpOT_ + 45
    11  BetShark                            0x000000010797d179 _ZNSt3__110__function6__funcIZZ45-[FSTAsyncQueryListener asyncSnapshotHandler]EUb_E3$_0NS_9allocatorIS2_EEFvvEEclEv + 41
    12  BetShark                            0x00000001079aa3d6 _ZNKSt3__18functionIFvvEEclEv + 102
    13  BetShark                            0x000000010792b9a1 _ZZN8firebase9firestore4util8internal13DispatchAsyncEPU28objcproto17OS_dispatch_queue8NSObjectONSt3__18functionIFvvEEEENK3$_0clEPv + 33
    14  BetShark                            0x000000010792b978 _ZZN8firebase9firestore4util8internal13DispatchAsyncEPU28objcproto17OS_dispatch_queue8NSObjectONSt3__18functionIFvvEEEEN3$_08__invokeEPv + 24
    15  libdispatch.dylib                   0x0000000111f56602 _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x0000000111f6399a _dispatch_main_queue_callback_4CF + 1541
    17  CoreFoundation                      0x0000000110e893e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    18  CoreFoundation                      0x0000000110e83a76 __CFRunLoopRun + 2342
    19  CoreFoundation                      0x0000000110e82e11 CFRunLoopRunSpecific + 625
    20  GraphicsServices                    0x00000001134781dd GSEventRunModal + 62
    21  UIKitCore                           0x0000000118e6681d UIApplicationMain + 140
    22  BetShark                            0x0000000107731f07 main + 71
    23  libdyld.dylib                       0x0000000111fcc575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

0 个答案:

没有答案