Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRDBDemoiOS sort by Name crash #844

Closed
viktoriakrasznai opened this issue Sep 30, 2020 · 5 comments
Closed

GRDBDemoiOS sort by Name crash #844

viktoriakrasznai opened this issue Sep 30, 2020 · 5 comments
Labels

Comments

@viktoriakrasznai
Copy link

What did you do?

I have cloned the GRDB.swift repo to my computer. I have opened GRDBDemoiOS in Xcode and I have started without any modification.

What did you expect to happen?

It did expect to work it without any crash.

What happened instead?

When I changed the sort order by Name it crashed.

Environment

GRDB flavor(s): (GRDB, SQLCipher, Custom SQLite build?)
GRDB version: latest
Installation method: GitHub clone
Xcode version: 12.0.1
Swift version: latest
Platform(s) running GRDB: iOS 14.0 Simulator
macOS version running Xcode: 10.15.7

Demo Project

https://github.com/groue/GRDB.swift/tree/master/Documentation/DemoApps/GRDBDemoiOS

@viktoriakrasznai
Copy link
Author

error

@viktoriakrasznai
Copy link
Author

Warning: Error creating LLDB target at path '/Users/xyz/Library/Developer/Xcode/DerivedData/GRDBDemoiOS-dqfrtuaqhaszcxdszutgpuoypyvc/Build/Products/Release-iphonesimulator/GRDBDemoiOS.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
2020-09-30 21:42:07.083139+0200 GRDBDemoiOS[26047:253347] *** Assertion failure in -[UITableView _Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Sections:], UITableView.m:2427
2020-09-30 21:42:07.087733+0200 GRDBDemoiOS[26047:253347] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (1) must be equal to the number of sections contained in the table view before the update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted).'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2043a126 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007fff20177f78 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff20439f4f +[NSException raise:format:] + 0
	3   Foundation                          0x00007fff207881ca -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   UIKitCore                           0x00007fff2485ba72 -[UITableView _Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Sections:] + 115
	5   UIKitCore                           0x00007fff2485ad79 -[UITableView _endCellAnimationsWithContext:] + 12759
	6   UIKitCore                           0x00007fff24875271 -[UITableView endUpdatesWithContext:] + 116
	7   UIKitCore                           0x00007fff24875443 -[UITableView _performBatchUpdates:withContext:completion:] + 253
	8   UIKitCore                           0x00007fff24875559 -[UITableView performBatchUpdates:completion:] + 97
	9   UIKitCore                           0x00007fff248a3070 -[UITableView _performDiffableUpdate:] + 49
	10  UIKitCore                           0x00007fff23d149e7 -[_UIDiffableDataSourceViewUpdater _performUpdateWithCollectionViewUpdateItems:dataSourceSnapshot:updateHandler:completion:viewPropertyAnimator:customAnimationsProvider:] + 916
	11  UIKitCore                           0x00007fff23d0bd72 -[__UIDiffableDataSource _commitNewDataSource:withViewUpdates:viewPropertyAnimator:customAnimationsProvider:commitAlongsideHandler:completion:] + 366
	12  UIKitCore                           0x00007fff23d0ad22 __113-[__UIDiffableDataSource _applyDifferencesFromSnapshot:viewPropertyAnimator:customAnimationsProvider:completion:]_block_invoke.218 + 298
	13  UIKitCore                           0x00007fff23d0b032 __113-[__UIDiffableDataSource _applyDifferencesFromSnapshot:viewPropertyAnimator:customAnimationsProvider:completion:]_block_invoke.238 + 107
	14  libdispatch.dylib                   0x0000000102378a88 _dispatch_client_callout + 8
	15  libdispatch.dylib                   0x0000000102387cac _dispatch_lane_barrier_sync_invoke_and_complete + 132
	16  UIKitCore                           0x00007fff23d0a969 -[__UIDiffableDataSource _applyDifferencesFromSnapshot:viewPropertyAnimator:customAnimationsProvider:completion:] + 1211
	17  UIKitCore                           0x00007fff23d09874 -[__UIDiffableDataSource applyDifferencesFromSnapshot:completion:] + 55
	18  UIKitCore                           0x00007fff23d09f25 -[__UIDiffableDataSource applyDifferencesFromSnapshot:animatingDifferences:completion:] + 71
	19  libswiftUIKit.dylib                 0x00007fff539f5a56 $s5UIKit34UICollectionViewDiffableDataSourceC5apply_20animatingDifferences10completionyAA010NSDiffableeF8SnapshotVyxq_G_SbyycSgtFTm + 230
	20  GRDBDemoiOS                         0x0000000101bbb9d5 $s11GRDBDemoiOS24PlayerListViewControllerC011updateTableE033_E66AFBE15CC6DEE91DA54CE766099650LL4withySayAA0C0VG_tF + 277
	21  GRDBDemoiOS                         0x0000000101bbd71a $s11GRDBDemoiOS24PlayerListViewControllerC014configureTableE033_E66AFBE15CC6DEE91DA54CE766099650LLyyFySayAA0C0VGcfU1_TA + 58
	22  GRDBDemoiOS                         0x0000000101bba184 $sSay11GRDBDemoiOS6PlayerVGIegg_ADIegn_TRTA + 20
	23  GRDB                                0x0000000101ea65a4 $s4GRDB13ValueObserverC12notifyChangeyy0B0QzFyycfU_TA + 164
	24  GRDB                                0x0000000101f11abe $sIeg_IeyB_TR + 14
	25  libdispatch.dylib                   0x00000001023778ac _dispatch_call_block_and_release + 12
	26  libdispatch.dylib                   0x0000000102378a88 _dispatch_client_callout + 8
	27  libdispatch.dylib                   0x0000000102386f23 _dispatch_main_queue_callback_4CF + 1152
	28  CoreFoundation                      0x00007fff203a8276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	29  CoreFoundation                      0x00007fff203a2b06 __CFRunLoopRun + 2685
	30  CoreFoundation                      0x00007fff203a1b9e CFRunLoopRunSpecific + 567
	31  GraphicsServices                    0x00007fff2b773db3 GSEventRunModal + 139
	32  UIKitCore                           0x00007fff24660af3 -[UIApplication _run] + 912
	33  UIKitCore                           0x00007fff24665a04 UIApplicationMain + 101
	34  GRDBDemoiOS                         0x0000000101bb7aca main + 58
	35  libdyld.dylib                       0x00007fff20257415 start + 1
	36  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (1) must be equal to the number of sections contained in the table view before the update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted).'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 (5C419D10-9B83-43D4-A705-726E27960E9F) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11 Pro
(lldb) 

@groue
Copy link
Owner

groue commented Oct 1, 2020

Thanks for the report, @Aczel!

Was it a mistake to switch to UITableViewDiffableDataSource? Anyway, I'll look into it.

@groue groue added the bug label Oct 1, 2020
@groue
Copy link
Owner

groue commented Oct 6, 2020

The fix will ship in the next version of the library.

@groue groue closed this as completed in bfc76b9 Oct 6, 2020
@groue
Copy link
Owner

groue commented Oct 6, 2020

GRDB 5.0.2 has shipped with a fixed demo application!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants