I was able to get the full crash log of the problem im having but absolutely failed to figure out what is exactly causing the problem in cellforRow, even though everything is optional, and the way i register the cell as the below :
messagesTable.register(UINib(nibName: "MessagesCell", bundle: .main), forCellReuseIdentifier: "MessagesCell")
Then i use the cell as
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if (pageArray[indexPath.row] as? Message)?.isAd ?? false{
let natvieCell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! NativeAdCell
natvieCell.parentVC = self
natvieCell.delegate = self
if let ad = NativeAdsDataSource.shared.getAdForDisplay() {
natvieCell.nativeAdPlaceholder.isHidden = false
natvieCell.loadAd(ad)
}else {
NativeAdsDataSource.shared.getNewAds(numberOfAds: 5)
natvieCell.nativeAdPlaceholder.isHidden = true
}
return natvieCell
}else {
let cell = tableView.dequeueReusableCell(withIdentifier: "MessagesCell", for: indexPath) as! MessagesCell
cell.populateCell(text: nil, parent: self,title:category?.name ?? "")
cell.delegate = self
cell.searchController = self.searchController
if (shouldShowSearchResults){
let message = resultofsearch[indexPath.row]
cell.populateData(message: message)
}else {
let message = pageArray[indexPath.row] as? Message ?? Message(message: "")
cell.populateData(message: message)
}
return cell
}
}
I am thinking about Thread 1, that something is crashing and the cause of Thread 1 not in 0 since it doesn't display enough information, willing that someone can advice.
And the crash log is as the below
CrashReporter Key: 892fa8f08ead0661fafc7f83ffd7ee14e3c58a23
Hardware Model: iPhone7,1
Process: APPNAME [7555]
Path: /private/var/containers/Bundle/Application/E94F806D-D35F-42C2-8AD3-BB92549E6D72/APPNAME.app/APPNAME
Identifier: com.COMPANY.APPNAME
Version: 2 (3.1.9)
AppStoreTools: 11E146
AppVariant: 1:iPhone7,1:12.2
Code Type: ARM-64 (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: com.COMPANY.APPNAME [1649]
Date/Time: 2020-04-14 07:20:21.2376 +0300
Launch Time: 2020-04-14 07:19:58.7723 +0300
OS Version: iPhone OS 12.4.5 (16G161)
Baseband Version: 7.80.04
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010070b298
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [7555]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 APPNAME 0x000000010070b298 MessagesDetail.tableView(_:cellForRowAt:) + 1196 (<compiler-generated>:0)
1 APPNAME 0x000000010070b330 @objc MessagesDetail.tableView(_:cellForRowAt:) + 140 (<compiler-generated>:0)
2 UIKitCore 0x00000001d65e3618 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 680 (UITableView.m:13737)
3 UIKitCore 0x00000001d65e3b18 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80 (UITableView.m:13788)
4 UIKitCore 0x00000001d65b0320 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2260 (UITableView.m:2655)
5 UIKitCore 0x00000001d65cd640 -[UITableView layoutSubviews] + 140 (UITableView.m:8744)
6 UIKitCore 0x00000001d685c170 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1292 (UIView.m:15707)
7 QuartzCore 0x00000001ae114c60 -[CALayer layoutSublayers] + 184 (CALayer.mm:9450)
8 QuartzCore 0x00000001ae119c08 CA::Layer::layout_if_needed(CA::Transaction*) + 332 (CALayer.mm:9330)
9 QuartzCore 0x00000001ae07c3e4 CA::Context::commit_transaction(CA::Transaction*) + 348 (CALayer.mm:2468)
10 QuartzCore 0x00000001ae0aa620 CA::Transaction::commit() + 640 (CATransactionInternal.mm:444)
11 UIKitCore 0x00000001d63be7e0 _UIApplicationFlushRunLoopCATransactionIfTooLate + 156 (UIApplication.m:2699)
12 UIKitCore 0x00000001d64a7408 __handleEventQueueInternal + 5604 (UIEventDispatcher.m:1966)
13 UIKitCore 0x00000001d64a0330 __handleHIDEventFetcherDrain + 152 (UIEventDispatcher.m:1905)
14 CoreFoundation 0x00000001a9b68f1c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1980)
15 CoreFoundation 0x00000001a9b68e9c __CFRunLoopDoSource0 + 88 (CFRunLoop.c:2015)
16 CoreFoundation 0x00000001a9b68784 __CFRunLoopDoSources0 + 176 (CFRunLoop.c:2051)
17 CoreFoundation 0x00000001a9b636c0 __CFRunLoopRun + 1004 (CFRunLoop.c:2922)
18 CoreFoundation 0x00000001a9b62fb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
19 GraphicsServices 0x00000001abd6479c GSEventRunModal + 104 (GSEvent.c:2245)
20 UIKitCore 0x00000001d63c4c38 UIApplicationMain + 212 (UIApplication.m:4353)
21 APPNAME 0x00000001006c0360 main + 68 (CurrencyCell.swift:21)
22 libdyld.dylib 0x00000001a96268e0 start + 4
Thread 1 name:
Thread 1:
0 libsystem_platform.dylib 0x00000001a97e4444 os_unfair_lock_unlock$VARIANT$mp + 12
1 libsystem_c.dylib 0x00000001a969951c arc4random + 192 (arc4random.c:180)
2 APPNAME 0x000000010070e20c specialized closure #1 in UnsafeMutableBufferPointer._stableSortImpl(by:) + 484 (Array+Extensions.swift:139)
3 APPNAME 0x000000010070df80 specialized UnsafeMutableBufferPointer._stableSortImpl(by:) + 220 (<compiler-generated>:0)
4 APPNAME 0x000000010070d100 specialized MutableCollection<>.sort(by:) + 140 (<compiler-generated>:0)
5 APPNAME 0x000000010070997c MessagesDetail.setTableViewMessagesArray(messages:shuffle:) + 236 (Array+Extensions.swift:139)
6 APPNAME 0x0000000100710628 partial apply for closure #1 in closure #2 in MessagesDetail.getTopOrNew() + 84
7 APPNAME 0x00000001006ce3ac closure #1 in Database.getMessages(categoryId:completionHandler:) + 572 (DatabaseManager.swift:138)
8 APPNAME 0x00000001006dfa54 thunk for @callee_guaranteed (@guaranteed FMDatabase, @unowned UnsafeMutablePointer<ObjCBool>) -> () + 20 (<compiler-generated>:0)
9 APPNAME 0x00000001006dfa8c thunk for @escaping @callee_guaranteed (@guaranteed FMDatabase, @unowned UnsafeMutablePointer<Obj... + 44 (<compiler-generated>:0)
10 FMDB 0x0000000100f0ca20 __46-[FMDatabaseQueue beginTransaction:withBlock:]_block_invoke + 248 (FMDatabaseQueue.m:230)
11 libdispatch.dylib 0x00000001a96157d4 _dispatch_client_callout + 16 (object.m:511)
12 libdispatch.dylib 0x00000001a95c3c1c _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:989)
13 FMDB 0x0000000100f0c908 -[FMDatabaseQueue beginTransaction:withBlock:] + 112 (FMDatabaseQueue.m:214)
14 APPNAME 0x00000001006ce0e4 Database.getMessages(categoryId:completionHandler:) + 280 (DatabaseManager.swift:130)
15 APPNAME 0x0000000100710708 partial apply for closure #1 in MessagesDetail.viewDidLoad() + 84 (MessagesDetail.swift:84)
16 APPNAME 0x00000001006d7d40 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
17 libdispatch.dylib 0x00000001a9614a38 _dispatch_call_block_and_release + 24 (init.c:1372)
18 libdispatch.dylib 0x00000001a96157d4 _dispatch_client_callout + 16 (object.m:511)
19 libdispatch.dylib 0x00000001a95b9c80 _dispatch_queue_override_invoke + 684 (inline_internal.h:2441)
20 libdispatch.dylib 0x00000001a95c6030 _dispatch_root_queue_drain + 372 (inline_internal.h:2482)
21 libdispatch.dylib 0x00000001a95c68d4 _dispatch_worker_thread2 + 128 (queue.c:6072)
22 libsystem_pthread.dylib 0x00000001a97f61b4 _pthread_wqthread + 464 (pthread.c:2361)
23 libsystem_pthread.dylib 0x00000001a97f8cd4 start_wqthread + 4
Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x00000001a97680f4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001a97675a0 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x00000001a9b68914 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x00000001a9b63824 __CFRunLoopRun + 1360 (CFRunLoop.c:2971)
4 CoreFoundation 0x00000001a9b62fb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 Foundation 0x00000001aa53195c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 (NSRunLoop.m:367)
6 Foundation 0x00000001aa5317ec -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 (NSRunLoop.m:411)
7 UIKitCore 0x00000001d64aa754 -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:606)
8 Foundation 0x00000001aa65e4a0 __NSThread__start__ + 984 (NSThread.m:1175)
9 libsystem_pthread.dylib 0x00000001a97f52c0 _pthread_body + 128 (pthread.c:857)
10 libsystem_pthread.dylib 0x00000001a97f5220 _pthread_start + 44 (pthread.c:884)
11 libsystem_pthread.dylib 0x00000001a97f8cdc thread_start + 4
Thread 3:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001a9772ee4 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x00000001a97edcf8 _pthread_cond_wait$VARIANT$mp + 636 (pthread_cond.c:578)
2 libc++.1.dylib 0x00000001a8d49090 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24 (__threading_support:278)
3 JavaScriptCore 0x00000001b0df7de0 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::uni... + 108 (condition_variable:204)
4 JavaScriptCore 0x00000001b0dfbdd4 bmalloc::Scavenger::threadRunLoop() + 176 (condition_variable:213)
5 JavaScriptCore 0x00000001b0dfb54c bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 12 (Scavenger.cpp:359)
6 JavaScriptCore 0x00000001b0dfcf8c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, st... + 40 (type_traits:4345)
7 libsystem_pthread.dylib 0x00000001a97f52c0 _pthread_body + 128 (pthread.c:857)
8 libsystem_pthread.dylib 0x00000001a97f5220 _pthread_start + 44 (pthread.c:884)
9 libsystem_pthread.dylib 0x00000001a97f8cdc thread_start + 4
Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x00000001a97680f4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001a97675a0 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x00000001a9b68914 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x00000001a9b63824 __CFRunLoopRun + 1360 (CFRunLoop.c:2971)
4 CoreFoundation 0x00000001a9b62fb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 AVFAudio 0x00000001afad5334 GenericRunLoopThread::Entry(void*) + 156 (GenericRunLoopThread.h:92)
6 AVFAudio 0x00000001afaffc60 CAPThread::Entry(CAPThread*) + 88
7 libsystem_pthread.dylib 0x00000001a97f52c0 _pthread_body + 128 (pthread.c:857)
8 libsystem_pthread.dylib 0x00000001a97f5220 _pthread_start + 44 (pthread.c:884)
9 libsystem_pthread.dylib 0x00000001a97f8cdc thread_start + 4
Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x00000001a97680f4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001a97675a0 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x00000001a9b68914 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x00000001a9b63824 __CFRunLoopRun + 1360 (CFRunLoop.c:2971)
4 CoreFoundation 0x00000001a9b62fb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 CoreFoundation 0x00000001a9b63d10 CFRunLoopRun + 80 (CFRunLoop.c:3271)
6 CoreMotion 0x00000001af53abe8 CLMotionCore::runMotionThread(void*) + 1020 (CLMotionCore.mm:330)
7 libsystem_pthread.dylib 0x00000001a97f52c0 _pthread_body + 128 (pthread.c:857)
8 libsystem_pthread.dylib 0x00000001a97f5220 _pthread_start + 44 (pthread.c:884)
9 libsystem_pthread.dylib 0x00000001a97f8cdc thread_start + 4
Thread 8:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 9 name:
Thread 9:
0 libsystem_kernel.dylib 0x00000001a97739f8 __ulock_wake + 8
1 libsystem_platform.dylib 0x00000001a97e44a4 _os_unfair_lock_unlock_slow + 64
2 libsystem_malloc.dylib 0x00000001a97c3908 tiny_malloc_should_clear + 1012 (locking.h:61)
3 libsystem_malloc.dylib 0x00000001a97afbf4 szone_malloc_should_clear + 76 (magazine_malloc.c:222)
4 libsystem_malloc.dylib 0x00000001a97b8acc malloc_zone_malloc + 156 (malloc.c:1578)
5 CoreFoundation 0x00000001a9c006a4 __CFBasicHashRehash + 188 (CFBasicHash.c:271)
6 CoreFoundation 0x00000001a9c02090 __CFBasicHashAddValue + 96 (CFBasicHash.c:1257)
7 CoreFoundation 0x00000001a9c017fc CFBasicHashAddValue + 2160 (CFBasicHash.c:1341)
8 CoreFoundation 0x00000001a9b144f0 _flattenPlist + 132 (CFBinaryPList.c:492)
9 CoreFoundation 0x00000001a9b14708 _flattenPlist + 668 (CFBinaryPList.c:521)
10 CoreFoundation 0x00000001a9b14698 _flattenPlist + 556 (CFBinaryPList.c:512)
11 CoreFoundation 0x00000001a9b14198 __CFBinaryPlistWriteOrPresize + 180 (CFBinaryPList.c:581)
12 CoreFoundation 0x00000001a9b5a1ac CFPropertyListWrite + 172 (CFPropertyList.c:3000)
13 CoreFoundation 0x00000001a9b5a034 CFPropertyListCreateData + 124 (CFPropertyList.c:2924)
14 CFNetwork 0x00000001aa25c414 HTTPMessage::copyHeadersWithShadowedArrayValues() + 220 (HTTPMessage.cpp:532)
15 CFNetwork 0x00000001aa249f4c URLResponse::createArchiveList(__CFAllocator const*, long*, void const***, long*) + 216 (URLResponse.cpp:655)
16 CFNetwork 0x00000001aa24a430 URLResponse::copyPropertyList(__CFAllocator const*) + 64 (URLResponse.cpp:788)
17 CFNetwork 0x00000001aa20d130 invocation function for block in __CFURLCache::CreateAndStoreCacheNode(__CFURLCacheNode*, _CFCach... + 1116 (URLResponse.h:242)
18 libdispatch.dylib 0x00000001a9614a38 _dispatch_call_block_and_release + 24 (init.c:1372)
19 libdispatch.dylib 0x00000001a96157d4 _dispatch_client_callout + 16 (object.m:511)
20 libdispatch.dylib 0x00000001a95be324 _dispatch_lane_serial_drain$VARIANT$mp + 592 (inline_internal.h:2441)
21 libdispatch.dylib 0x00000001a95bee40 _dispatch_lane_invoke$VARIANT$mp + 428 (queue.c:3805)
22 libdispatch.dylib 0x00000001a95c74ac _dispatch_workloop_worker_thread + 596 (queue.c:5889)
23 libsystem_pthread.dylib 0x00000001a97f6114 _pthread_wqthread + 304 (pthread.c:2371)
24 libsystem_pthread.dylib 0x00000001a97f8cd4 start_wqthread + 4
Thread 10:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 11:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 12 name:
Thread 12:
0 libsystem_kernel.dylib 0x00000001a97680f4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001a97675a0 mach_msg + 72 (mach_msg.c:103)
2 libdispatch.dylib 0x00000001a9610408 _dispatch_send_wakeup_runloop_thread + 64 (protocolUser.c:528)
3 libdispatch.dylib 0x00000001a95c2120 _dispatch_runloop_queue_poke + 244 (queue.c:6499)
4 APPNAME 0x00000001007d7c88 __93-[FIRInstanceIDTokenManager fetchNewTokenWithAuthorizedEntity:scope:keyPair:options:handler:]... + 160 (FIRInstanceIDTokenManager.m:132)
5 APPNAME 0x00000001007d9684 -[FIRInstanceIDTokenOperation finishWithResult:token:error:] + 276 (FIRInstanceIDTokenOperation.m:159)
6 APPNAME 0x00000001007d647c -[FIRInstanceIDTokenFetchOperation handleResponseWithData:response:error:] + 388 (FIRInstanceIDTokenFetchOperation.m:142)
7 APPNAME 0x00000001007d62cc __57-[FIRInstanceIDTokenFetchOperation performTokenOperation]_block_invoke + 104 (FIRInstanceIDTokenFetchOperation.m:107)
8 CFNetwork 0x00000001aa1ac688 __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32 (LocalSession.mm:637)
9 CFNetwork 0x00000001aa1c0220 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 176 (LocalSessionTask.mm:526)
10 Foundation 0x00000001aa63ccf4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16 (NSOperation.m:1559)
11 Foundation 0x00000001aa548d90 -[NSBlockOperation main] + 72 (NSOperation.m:1578)
12 Foundation 0x00000001aa548278 -[__NSOperationInternal _start:] + 740 (NSOperation.m:907)
13 Foundation 0x00000001aa63ea78 __NSOQSchedule_f + 272 (NSOperation.m:2165)
14 libdispatch.dylib 0x00000001a9614a38 _dispatch_call_block_and_release + 24 (init.c:1372)
15 libdispatch.dylib 0x00000001a96157d4 _dispatch_client_callout + 16 (object.m:511)
16 libdispatch.dylib 0x00000001a95ba01c _dispatch_continuation_pop$VARIANT$mp + 412 (inline_internal.h:2441)
17 libdispatch.dylib 0x00000001a95b96e0 _dispatch_async_redirect_invoke + 600 (queue.c:796)
18 libdispatch.dylib 0x00000001a95c6030 _dispatch_root_queue_drain + 372 (inline_internal.h:2482)
19 libdispatch.dylib 0x00000001a95c68d4 _dispatch_worker_thread2 + 128 (queue.c:6072)
20 libsystem_pthread.dylib 0x00000001a97f61b4 _pthread_wqthread + 464 (pthread.c:2361)
21 libsystem_pthread.dylib 0x00000001a97f8cd4 start_wqthread + 4
Thread 13:
0 libsystem_pthread.dylib 0x00000001a97f8cd0 start_wqthread + 0
Thread 14 name:
Thread 14:
0 libsystem_kernel.dylib 0x00000001a97680f4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001a97675a0 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x00000001a9b68914 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x00000001a9b63824 __CFRunLoopRun + 1360 (CFRunLoop.c:2971)
4 CoreFoundation 0x00000001a9b62fb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 CFNetwork 0x00000001aa17d74c -[__CoreSchedulingSetRunnable runForever] + 216 (CoreSchedulingSet.mm:1365)
6 Foundation 0x00000001aa65e4a0 __NSThread__start__ + 984 (NSThread.m:1175)
7 libsystem_pthread.dylib 0x00000001a97f52c0 _pthread_body + 128 (pthread.c:857)
8 libsystem_pthread.dylib 0x00000001a97f5220 _pthread_start + 44 (pthread.c:884)
9 libsystem_pthread.dylib 0x00000001a97f8cdc thread_start + 4