I'm currently trying to write a dispatcher for iOS, to run Http requests in the background. My current attempt is the following object:
val runCoroutineDispatcher: CoroutineContext = NsQueueDispatcher
object NsQueueDispatcher: CoroutineDispatcher(){
override fun dispatch(
context: CoroutineContext,
block: Runnable
){
dispatch_async(
dispatch_get_global_queue(
NSNumber(double = DISPATCH_QUEUE_PRIORITY_DEFAULT.toDouble()).integerValue,
0)
) {
block.run()
}
}
}
If I try to use this dispatcher for a coroutine I always get the issue
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared de.ubimax.common.dispatcher.NsGlobalQueueDispatcher.$dispatch$lambda-0$FUNCTION_REFERENCE$1#8147aca8 from other thread
at 0 FrontlineClientCommon 0x00000001012d0fec kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable + 92
at 1 FrontlineClientCommon 0x00000001012c9ebc kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 88
at 2 FrontlineClientCommon 0x00000001012c9980 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 88
at 3 FrontlineClientCommon 0x00000001012f92dc kfun:kotlin.native.IncorrectDereferenceException.<init>(kotlin.String)kotlin.native.IncorrectDereferenceException + 88
at 4 FrontlineClientCommon 0x00000001012fae84 ThrowIllegalObjectSharingException + 512
at 5 FrontlineClientCommon 0x000000010185cc9c _ZNK16KRefSharedHolder3refEv + 100
at 6 FrontlineClientCommon 0x0000000101879144 Kotlin_Interop_unwrapKotlinObjectHolder + 48
at 7 FrontlineClientCommon 0x00000001017aa184 _knbridge33 + 120
at 8 libdispatch.dylib 0x0000000108bed7fc _dispatch_call_block_and_release + 24
at 9 libdispatch.dylib 0x0000000108beebd8 _dispatch_client_callout + 16
at 10 libdispatch.dylib 0x0000000108bf12d4 _dispatch_queue_override_invoke + 872
at 11 libdispatch.dylib 0x0000000108c00160 _dispatch_root_queue_drain + 376
at 12 libdispatch.dylib 0x0000000108c00a88 _dispatch_worker_thread2 + 156
at 13 libsystem_pthread.dylib 0x00000001a6160f48 _pthread_wqthread + 212
at 14 libsystem_pthread.dylib 0x00000001a6163ad4 start_wqthread + 8
Sample code:
CoroutineScope(runCoroutineDispatcher).launch {
println("Hello World")
}
So far I only could find examples with the usage of dispatch_get_main_queue() instead of dispatch_get_global_queue().
Related
We are getting this crash on multiple devices but cannot figure out where it originates from. The main thread is crashing.
Stack trace:
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x193dfd58c object_getMethodImplementation + 20
1 CoreFoundation 0x1940f6928 _NSIsNSSet + 40
2 CoreFoundation 0x193fc2c04 -[NSMutableSet unionSet:] + 112
3 CoreData 0x198abe014 -[_NSFaultingMutableSet willReadWithContents:] + 668
4 CoreData 0x198ae4280 -[_NSFaultingMutableSet count] + 32
5 CoreData 0x198be1bb4 __107-[NSManagedObjectContext(_NestedContextSupport) newValueForRelationship:forObjectWithID:withContext:error:]_block_invoke + 360
6 CoreData 0x198be2e70 internalBlockToNSManagedObjectContextPerform + 104
7 libdispatch.dylib 0x193d8b5ac _dispatch_client_callout + 20
8 libdispatch.dylib 0x193d9843c _dispatch_async_and_wait_invoke + 96
9 libdispatch.dylib 0x193d8b5ac _dispatch_client_callout + 20
10 libdispatch.dylib 0x193d977d4 _dispatch_main_queue_callback_4CF + 832
11 CoreFoundation 0x1940648d4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
12 CoreFoundation 0x19405f58c __CFRunLoopRun + 1692
13 CoreFoundation 0x19405ebc8 CFRunLoopRunSpecific + 480
14 GraphicsServices 0x19e4475cc GSEventRunModal + 164
15 UIKitCore 0x198211744 UIApplicationMain + 1936
16 My App 0x100b37324 main + 16 (main.m:16)
17 libdyld.dylib 0x193edb384 start + 4
At the same time, a background thread operating in a PrivateQueue ManagedObjectContext is busy accessing a ManagedObject via awakeFromFetch, stack trace of this thread:
NSManagedObjectContext 0x28066c700
0 libsystem_kernel.dylib 0x1b09617e4 __ulock_wait + 8
1 libdispatch.dylib 0x1b081bf48 _dlock_wait + 56
2 libdispatch.dylib 0x1b081bcf4 _dispatch_thread_event_wait_slow + 56
3 libdispatch.dylib 0x1b0828618 __DISPATCH_WAIT_FOR_QUEUE__ + 336
4 libdispatch.dylib 0x1b0828204 _dispatch_sync_f_slow + 144
5 CoreData 0x1b56686cc _perform + 200
6 CoreData 0x1b558e2c4 -[NSManagedObjectContext(_NestedContextSupport) newValueForRelationship:forObjectWithID:withContext:error:] + 156
7 CoreData 0x1b555033c -[NSFaultHandler retainedFulfillAggregateFaultForObject:andRelationship:withContext:] + 428
8 CoreData 0x1b554df10 -[_NSFaultingMutableSet willReadWithContents:] + 408
9 CoreData 0x1b55ea5bc -[_NSFaultingMutableSet allObjects] + 32
10 My App 0x1044fdc3c PSUser.isAdmin.getter + 286 (PSUser.swift:286)
11 My App 0x1044fdb04 #objc PSUser.isAdmin.getter + 4309900036 (<compiler-generated>:4309900036)
12 My App 0x1044fc694 PSUser.initCurrentTeam() + 212 (PSUser.swift:212)
13 My App 0x1044fcbc0 #objc PSUser.initCurrentTeam() + 4309896128 (<compiler-generated>:4309896128)
14 My App 0x1044fc658 #objc PSUser.awakeFromFetch() + 4309894744 (<compiler-generated>:4309894744)
15 CoreData 0x1b56520e4 _PFFaultHandlerFulfillFault + 3168
16 CoreData 0x1b5650ab0 _PFFaultHandlerLookupRow + 908
17 CoreData 0x1b56527fc _PF_FulfillDeferredFault + 260
18 CoreData 0x1b5666a2c _pvfk_header + 120
19 CoreData 0x1b5663218 _sharedIMPL_pvfk_core + 32
20 My App 0x10438918c +[PSAppSettings isAutoPilotAllowed:] + 97 (PSAppSettings.m:97)
21 My App 0x1043fbb9c LocationTracker.updateTrackingState(user:) + 1120 (LocationTracker.swift:1120)
22 My App 0x104413b4c partial apply for closure #1 in LocationTracker.store(filteredLocations:) + 1275 (LocationTracker.swift:1275)
23 My App 0x1043bae3c thunk for #escaping #callee_guaranteed () -> () + 4308577852 (<compiler-generated>:4308577852)
24 CoreData 0x1b566b650 developerSubmittedBlockToNSManagedObjectContextPerform + 164
25 libdispatch.dylib 0x1b081b5ac _dispatch_client_callout + 20
26 libdispatch.dylib 0x1b0821a64 _dispatch_lane_serial_drain + 568
27 libdispatch.dylib 0x1b0822498 _dispatch_lane_invoke + 400
28 libdispatch.dylib 0x1b082ba5c _dispatch_workloop_worker_thread + 584
29 libsystem_pthread.dylib 0x1b0881718 _pthread_wqthread + 276
30 libsystem_pthread.dylib 0x1b08879c8 start_wqthread + 8
I am not certain if the two stacks are related, or if the background thread is dispatching anything to the main thread (why should it?), but the call newValueForRelationship:forObjectWithID:withContext:error does appear in both stack traces.
The method for awakeFromFetch is initializing a calculated object property currentTeam via the initCurrentTeam() method. This method accesses the teams relationship on that object. Here is the relevant code:
#objc extension PSUser {
override open func awakeFromFetch() {
super.awakeFromFetch()
initCurrentTeam()
}
/**
This method sets the currentTeam by picking
the appropriate team from the `teams` set.
*/
func initCurrentTeam() {
if (isAdmin || isManager), !isEmployee,
var teams = teams?.allObjects as? [PSTeam],
currentTeam == nil {
...
currentTeam = teams.first
}
}
...
}
Enabled com.apple.CoreData.ConcurrencyDebug in Xcode Scheme but Xcode console does not complain. I have not been able to reproduce this issue while debugging in Xcode. The issue is only reported via Crashlytics in production environment.
Any ideas what might be causing this?
I have a concerning amount of crashes for my iOS app. When I look at the stacktrace I can follow the flow of the stacktrace up until the 3d line 'fetchDeezerTracks(forAlbum)'. When inspecting my code it should be impossible for this line to be even called. the ApplePlayerManager.play method calls the ApplePlayerManager.fetchTrackIds method which calls a NetworkManager's 'fetchAppleMusicTracks' and this method has a networkRequestResponseHandler to deal with the fetched data, but NEVER ever should/could the 'fetchDeezerTracks' method be called.
My question is the following: Is it possible for Crashlytics to give incorrect reports maybe when the device's free RAM is insufficient? Maybe due to memory leaks or something... I just can't make sense out of the crash report so it would help me a lot to know if something else is at play. Some of the free RAM values of the multiple reports (of the same crash) are the following:
233MB (iPad Air 2), 8MB (iPAad 5th gen), 198MB (iPad Mini 2), 332MB (iPad Mini), 71MB (iPad Air 2), 174MB (iPad 5th gen), 223MB (iPad Air 2), 130MB (iPhone6+), 58MB (iPhoneXR), 381MB (iPhoneXSMax), etc.
Are these normal values?
If these are normal values and crashlytics reports are never "corrupted" then I need to make sense of the stacktrace. I'll add my networking code for reference.
Any help very much appreciated! This is driving me mad and crashes keep on piling up.
Crashed: com.apple.root.background-qos
0 MyApp 0x10045da40 closure #2 in ApplePlayerManager.play(album:withTrack:) + 4302494272 (<compiler-generated>:4302494272)
1 MyApp 0x10045d884 closure #1 in closure #1 in ApplePlayerManager.fetchTrackIds(forAlbum:completionHandler:) + 4302493828 (<compiler-generated>:4302493828)
2 MyApp 0x1004da218 specialized NetworkManager.networkRequestResponseHandler(withResponse:completionHandler:retryHandler:) + 4303004184 (<compiler-generated>:4303004184)
3 MyApp 0x1004d9404 closure #1 in NetworkManager.fetchDeezerTracks(forAlbum:withAccessToken:withCompletionHandler:) + 4303000580
4 MyApp 0x1004d8294 closure #1 in NetworkManager.fetchAppleMusicTracks(forAlbumID:withAccessToken:withCompletionHandler:) + 4302996116
5 Alamofire 0x100a73e64 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5Tm + 132
6 Alamofire 0x100a79d08 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5TATm + 36
7 Alamofire 0x100a5b3b0 $sIeg_IeyB_TR + 28
8 libdispatch.dylib 0x18f0eb9a8 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x18f0ec524 _dispatch_client_callout + 16
10 libdispatch.dylib 0x18f0a156c _dispatch_root_queue_drain + 684
11 libdispatch.dylib 0x18f0a1bf8 _dispatch_worker_thread2 + 124
12 libsystem_pthread.dylib 0x18f13db38 _pthread_wqthread + 212
13 libsystem_pthread.dylib 0x18f140740 start_wqthread + 8
How I fetch my trackIds (NetworkManager)
func fetchAppleMusicTracks(forAlbumID albumID:String,
withAccessToken accessToken:String,
withCompletionHandler completionHandler:#escaping(JSON?)->Void) {
let url = kAppleMusicAlbumURL + albumID
guard let encodedURL = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { return completionHandler(nil) }
let headers = [kAppleMusicAuthoritationKey : kAppleMusicBearerKey + accessToken]
Alamofire.request(encodedURL,
method: .get,
parameters: nil,
encoding: URLEncoding.default,
headers: headers).responseJSON(queue: backgroundQueue) {
[weak self]
response in
guard let self = self else { completionHandler(nil); return }
self.networkRequestResponseHandler(withResponse:response,
completionHandler:completionHandler) {
self.fetchAppleMusicTracks(forAlbumID: albumID,
withAccessToken: accessToken,
withCompletionHandler: completionHandler)
}
}
}
my network request handler (NetworkManager):
func networkRequestResponseHandler(withResponse response:DataResponse<Any>,
completionHandler: #escaping(JSON?)->Void,
retryHandler: #escaping()->Void) {
switch response.result {
case .success(let value):
completionHandler(JSON(value))
case .failure(let error):
if self.noConnectionValidator(forError: error, withRetryHandler:retryHandler) { return completionHandler(nil) }
if let status = response.response?.statusCode {
let message = BackendManager.sharedInstance.APIErrorMessageHandler(status: status)
AlertsManager.sharedInstance.displayAlertWithOKButton(forTitle: kGenericErrorTitle,
message: message,
buttonTitle: "Ok")
} else {
AlertsManager.sharedInstance.displayNetworkErrorMessage(withError: error)
}
completionHandler(nil)
}
}
method to fetch tracks (ApplePlayerManager):
private func fetchTrackIds(forAlbum album:String, completionHandler:#escaping([String]?)->Void) {
retrieveAccessToken {
accessToken in
guard let accessToken = accessToken else { completionHandler(nil); return }
NetworkManager.sharedInstance.fetchAppleMusicTracks(forAlbumID: album, withAccessToken: accessToken) {
JSON in
guard let JSON = JSON else {
completionHandler(nil)
return
}
if let tracks = JSON[kAppleMusicDataKey].array?[0][kAppleMusicRelationshipsKey][kAppleMusicTracksKey][kAppleMusicDataKey].array {
let trackIds = tracks.map{ $0[kAppleMusicTrackIdentifierKey].string }.compactMap{ $0 }
completionHandler(trackIds)
} else {
//AlertsManager.sharedInstance.displayAppleMusicCouldNotFetchTracks()
completionHandler(nil)
}
}
}
}
entry-point -> method to play an Apple track (ApplePlayerManager):
override public func play(album:String, withTrack track:Int) {
super.play(album: album, withTrack: track)
guard let streamingManager = streamingManager else { return setup { self.play(album: album, withTrack: track) } }
indexOfLastPlayingItem = track
fetchTrackIds(forAlbum: album) {
[weak self]
trackIds in
guard let self = self else { return }
guard let trackIds = trackIds else {
return //AlertsManager.sharedInstance.displayAppleMusicTracksFetchFailed()
}
self.loadedAlbumTrackIDs = trackIds
if let remainingTracks = self.calculateRemainingTrackList(fromCurrentTrack: track) {
ThreadManager.sharedInstance.executeOnMainThread {
self.play(forStreamingManager: streamingManager, remainingTracks: remainingTracks)
}
}
}
}
EDIT - MORE INFO:
Since my app is using multiple services, I made an abstract PlayerManager singleton class with concrete singleton subclasses for every service. so the PlayerManager.play(track: trackId) will call the correct concrete class method on ApplePlayerManager if beforehand the PlayerManager.service is set to .Apple
I know it looks like somewhere in code the singleton has incorrectly changed service, but again it would not make any sense + I can not reproduce it nor getting a breakpoint hit.
EDIT PART II - ALL THREADS STACKTRACES:
I am getting the suspicion that this might be thread related? Here are all the threads:
Crashed: com.apple.root.background-qos
EXC_BREAKPOINT 0x0000000104cd5a40
Crashed: com.apple.root.background-qos
0 MyApp 0x104cd5a40 closure #2 in ApplePlayerManager.play(album:withTrack:) + 4376304192 (<compiler-generated>:4376304192)
1 MyApp 0x104cd5884 closure #1 in closure #1 in ApplePlayerManager.fetchTrackIds(forAlbum:completionHandler:) + 4376303748 (<compiler-generated>:4376303748)
2 MyApp 0x104d52218 specialized NetworkManager.networkRequestResponseHandler(withResponse:completionHandler:retryHandler:) + 4376814104 (<compiler-generated>:4376814104)
3 MyApp 0x104d51404 closure #1 in NetworkManager.fetchDeezerTracks(forAlbum:withAccessToken:withCompletionHandler:) + 4376810500
4 MyApp 0x104d50294 closure #1 in NetworkManager.fetchAppleMusicTracks(forAlbumID:withAccessToken:withCompletionHandler:) + 4376806036
5 Alamofire 0x105313e64 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5Tm + 132
6 Alamofire 0x105319d08 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5TATm + 36
7 Alamofire 0x1052fb3b0 $sIeg_IeyB_TR + 28
8 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
10 libdispatch.dylib 0x1b2e8165c _dispatch_root_queue_drain + 640
11 libdispatch.dylib 0x1b2e81cd0 _dispatch_worker_thread2 + 112
12 libsystem_pthread.dylib 0x1b2eecb38 _pthread_wqthread + 212
13 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
com.apple.main-thread
com.apple.main-thread
0 libsystem_kernel.dylib 0x1b2fa9198 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b2fa860c mach_msg + 72
2 CoreFoundation 0x1b31533b4 __CFRunLoopServiceMachPort + 148
3 CoreFoundation 0x1b314e3e8 __CFRunLoopRun + 1160
4 CoreFoundation 0x1b314dc34 CFRunLoopRunSpecific + 424
5 GraphicsServices 0x1bd29738c GSEventRunModal + 160
6 UIKitCore 0x1b728022c UIApplicationMain + 1932
7 MyApp 0x104cd1060 main + 12 (AppDelegate.swift:12)
8 libdyld.dylib 0x1b2fd5800 start + 4
com.apple.uikit.eventfetch-thread
com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1b2fa9198 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b2fa860c mach_msg + 72
2 CoreFoundation 0x1b31533b4 __CFRunLoopServiceMachPort + 148
3 CoreFoundation 0x1b314e3e8 __CFRunLoopRun + 1160
4 CoreFoundation 0x1b314dc34 CFRunLoopRunSpecific + 424
5 Foundation 0x1b3490bcc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228
6 Foundation 0x1b3490aac -[NSRunLoop(NSRunLoop) runUntilDate:] + 88
7 UIKitCore 0x1b7322160 -[UIEventFetcher threadMain] + 152
8 Foundation 0x1b35bf9d0 __NSThread__start__ + 848
9 libsystem_pthread.dylib 0x1b2eebd98 _pthread_start + 156
10 libsystem_pthread.dylib 0x1b2eef74c thread_start + 8
com.twitter.crashlytics.ios.MachExceptionServer
com.twitter.crashlytics.ios.MachExceptionServer
0 MyApp 0x104d7b448 CLSProcessRecordAllThreads + 4376982600
1 MyApp 0x104d7b830 CLSProcessRecordAllThreads + 4376983600
2 MyApp 0x104d6b09c CLSHandler + 4376916124
3 MyApp 0x104d66ac4 CLSMachExceptionServer + 4376898244
4 libsystem_pthread.dylib 0x1b2eebd98 _pthread_start + 156
5 libsystem_pthread.dylib 0x1b2eef74c thread_start + 8
com.apple.root.background-qos
com.apple.root.background-qos
0 libsystem_malloc.dylib 0x1b2ec6154 calloc + 98
1 CoreFoundation 0x1b31e23c4 __CFAllocateObject + 20
2 CoreFoundation 0x1b3205b38 __NSDictionaryM_new + 128
3 Foundation 0x1b3586e68 _encodeObject + 964
4 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
5 Foundation 0x1b3586f58 _encodeObject + 1204
6 MyApp 0x104d372f8 Album.encode(with:) + 4376703736 (<compiler-generated>:4376703736)
7 MyApp 0x104d37354 #objc Album.encode(with:) + 4376703828 (<compiler-generated>:4376703828)
8 Foundation 0x1b3586f58 _encodeObject + 1204
9 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
10 Foundation 0x1b3586f58 _encodeObject + 1204
11 MyApp 0x104cec884 Series.encode(with:) + 4376397956 (<compiler-generated>:4376397956)
12 MyApp 0x104cec93c #objc Series.encode(with:) + 4376398140 (<compiler-generated>:4376398140)
13 Foundation 0x1b3586f58 _encodeObject + 1204
14 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
15 Foundation 0x1b3586f58 _encodeObject + 1204
16 MyApp 0x104cfcaf0 User.encode(with:) + 4376464112 (<compiler-generated>:4376464112)
17 MyApp 0x104cfcc64 #objc User.encode(with:) + 4376464484 (<compiler-generated>:4376464484)
18 Foundation 0x1b3586f58 _encodeObject + 1204
19 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
20 Foundation 0x1b34ccea0 -[NSDictionary(NSDictionary) encodeWithCoder:] + 876
21 Foundation 0x1b3586f58 _encodeObject + 1204
22 Foundation 0x1b34ed5c8 +[NSKeyedArchiver archivedDataWithRootObject:] + 124
23 SwiftyUserDefaults 0x105c9b8c4 $sSo14NSUserDefaultsC010SwiftyUserB0E7archiveyyAC0B3KeyCyxSgG_AGtlF + 292
24 MyApp 0x104d3a7f8 closure #1 in UserManager._cachedSavedUsers.didset + 4376717304 (<compiler-generated>:4376717304)
25 MyApp 0x104d05e10 partial apply for closure #1 in ThreadManager.executeOnMainThread(afterSeconds:withBlock:) + 4376501776 (<compiler-generated>:4376501776)
26 MyApp 0x104d5fc98 thunk for #escaping #callee_guaranteed () -> () + 4376870040 (<compiler-generated>:4376870040)
27 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
28 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
29 libdispatch.dylib 0x1b2e8165c _dispatch_root_queue_drain + 640
30 libdispatch.dylib 0x1b2e81cd0 _dispatch_worker_thread2 + 112
31 libsystem_pthread.dylib 0x1b2eecb38 _pthread_wqthread + 212
32 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
com.apple.NSURLConnectionLoader
com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1b2fa9198 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b2fa860c mach_msg + 72
2 CoreFoundation 0x1b31533b4 __CFRunLoopServiceMachPort + 148
3 CoreFoundation 0x1b314e3e8 __CFRunLoopRun + 1160
4 CoreFoundation 0x1b314dc34 CFRunLoopRunSpecific + 424
5 CFNetwork 0x1b6412c44 (Missing)
6 Foundation 0x1b35bf9d0 __NSThread__start__ + 848
7 libsystem_pthread.dylib 0x1b2eebd98 _pthread_start + 156
8 libsystem_pthread.dylib 0x1b2eef74c thread_start + 8
com.apple.root.background-qos
com.apple.root.background-qos
0 libsystem_platform.dylib 0x1b2edd948 _platform_memmove + 88
1 libsystem_malloc.dylib 0x1b2ebc628 szone_realloc + 544
2 libsystem_malloc.dylib 0x1b2ec5a9c malloc_zone_realloc + 168
3 libsystem_malloc.dylib 0x1b2ec625c realloc + 196
4 CoreFoundation 0x1b30f3948 __CFSafelyReallocate + 28
5 Foundation 0x1b3555ea0 _NSMutableDataGrowBytes + 344
6 Foundation 0x1b34a2a34 -[NSConcreteMutableData appendBytes:length:] + 340
7 CoreFoundation 0x1b30fcfac writeBytes + 164
8 CoreFoundation 0x1b30fa01c bufferWrite + 320
9 CoreFoundation 0x1b30fd144 _appendString + 264
10 CoreFoundation 0x1b30fa1b8 _appendObject + 348
11 CoreFoundation 0x1b30f99fc __CFBinaryPlistWriteOrPresize + 528
12 Foundation 0x1b34a27d0 -[NSKeyedArchiver finishEncoding] + 528
13 Foundation 0x1b34ed5d8 +[NSKeyedArchiver archivedDataWithRootObject:] + 140
14 SwiftyUserDefaults 0x105c9b8c4 $sSo14NSUserDefaultsC010SwiftyUserB0E7archiveyyAC0B3KeyCyxSgG_AGtlF + 292
15 MyApp 0x104d3a3bc closure #1 in UserManager._cachedActiveUser.didset + 4376716220 (<compiler-generated>:4376716220)
16 MyApp 0x104d05e10 partial apply for closure #1 in ThreadManager.executeOnMainThread(afterSeconds:withBlock:) + 4376501776 (<compiler-generated>:4376501776)
17 MyApp 0x104d5fc98 thunk for #escaping #callee_guaranteed () -> () + 4376870040 (<compiler-generated>:4376870040)
18 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
20 libdispatch.dylib 0x1b2e8165c _dispatch_root_queue_drain + 640
21 libdispatch.dylib 0x1b2e81cd0 _dispatch_worker_thread2 + 112
22 libsystem_pthread.dylib 0x1b2eecb38 _pthread_wqthread + 212
23 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
AVAudioSession Notify Thread
AVAudioSession Notify Thread
0 libsystem_kernel.dylib 0x1b2fa9198 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b2fa860c mach_msg + 72
2 CoreFoundation 0x1b31533b4 __CFRunLoopServiceMachPort + 148
3 CoreFoundation 0x1b314e3e8 __CFRunLoopRun + 1160
4 CoreFoundation 0x1b314dc34 CFRunLoopRunSpecific + 424
5 AVFAudio 0x1bfef65dc GenericRunLoopThread::Entry(void*) + 156
6 AVFAudio 0x1bff47300 CAPThread::Entry(CAPThread*) + 204
7 libsystem_pthread.dylib 0x1b2eebd98 _pthread_start + 156
8 libsystem_pthread.dylib 0x1b2eef74c thread_start + 8
Thread #1
Thread
0 libsystem_kernel.dylib 0x1b2fcb940 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1b2eecbc0 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
Thread #2
Thread
0 libsystem_pthread.dylib 0x1b2eef738 start_wqthread + 190
com.apple.root.background-qos
com.apple.root.background-qos
0 CoreFoundation 0x1b3206828 mdict_rehashd + 244
1 CoreFoundation 0x1b30b8f00 -[__NSDictionaryM __setObject:forKey:] + 888
2 Foundation 0x1b35876d8 addValueToTopContainerE + 128
3 Foundation 0x1b3587180 _encodeObject + 1756
4 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
5 Foundation 0x1b3586f58 _encodeObject + 1204
6 MyApp 0x104d372f8 Album.encode(with:) + 4376703736 (<compiler-generated>:4376703736)
7 MyApp 0x104d37354 #objc Album.encode(with:) + 4376703828 (<compiler-generated>:4376703828)
8 Foundation 0x1b3586f58 _encodeObject + 1204
9 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
10 Foundation 0x1b3586f58 _encodeObject + 1204
11 MyApp 0x104cec884 Series.encode(with:) + 4376397956 (<compiler-generated>:4376397956)
12 MyApp 0x104cec93c #objc Series.encode(with:) + 4376398140 (<compiler-generated>:4376398140)
13 Foundation 0x1b3586f58 _encodeObject + 1204
14 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
15 Foundation 0x1b3586f58 _encodeObject + 1204
16 MyApp 0x104cfcaf0 User.encode(with:) + 4376464112 (<compiler-generated>:4376464112)
17 MyApp 0x104cfcc64 #objc User.encode(with:) + 4376464484 (<compiler-generated>:4376464484)
18 Foundation 0x1b3586f58 _encodeObject + 1204
19 Foundation 0x1b34a2334 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 360
20 Foundation 0x1b34ccea0 -[NSDictionary(NSDictionary) encodeWithCoder:] + 876
21 Foundation 0x1b3586f58 _encodeObject + 1204
22 Foundation 0x1b34ed5c8 +[NSKeyedArchiver archivedDataWithRootObject:] + 124
23 SwiftyUserDefaults 0x105c9b8c4 $sSo14NSUserDefaultsC010SwiftyUserB0E7archiveyyAC0B3KeyCyxSgG_AGtlF + 292
24 MyApp 0x104d3a7f8 closure #1 in UserManager._cachedSavedUsers.didset + 4376717304 (<compiler-generated>:4376717304)
25 MyApp 0x104d05e10 partial apply for closure #1 in ThreadManager.executeOnMainThread(afterSeconds:withBlock:) + 4376501776 (<compiler-generated>:4376501776)
26 MyApp 0x104d5fc98 thunk for #escaping #callee_guaranteed () -> () + 4376870040 (<compiler-generated>:4376870040)
27 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
28 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
29 libdispatch.dylib 0x1b2e8165c _dispatch_root_queue_drain + 640
30 libdispatch.dylib 0x1b2e81cd0 _dispatch_worker_thread2 + 112
31 libsystem_pthread.dylib 0x1b2eecb38 _pthread_wqthread + 212
32 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
com.apple.root.background-qos
com.apple.root.background-qos
0 libobjc.A.dylib 0x1b2f12aa8 objc_release + 24
1 libswiftCore.dylib 0x1c0914680 swift_arrayDestroy + 68
2 libswiftCore.dylib 0x1c06d38c8 _DictionaryStorage.deinit + 360
3 libswiftCore.dylib 0x1c06d394c _DictionaryStorage.__deallocating_deinit + 12
4 libswiftCore.dylib 0x1c091e320 _swift_release_dealloc + 28
5 SwiftyJSON 0x105c396d0 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 1400
6 SwiftyJSON 0x105c394a4 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 844
7 SwiftyJSON 0x105c395d8 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 1152
8 SwiftyJSON 0x105c394a4 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 844
9 SwiftyJSON 0x105c394a4 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 844
10 SwiftyJSON 0x105c394a4 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 844
11 SwiftyJSON 0x105c395d8 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 1152
12 SwiftyJSON 0x105c394a4 $s10SwiftyJSON6unwrap33_4625CC38AABF536BB76490A35D7233C9LLyypypF + 844
13 SwiftyJSON 0x105c383e4 $s10SwiftyJSON0B0V6objectypvs + 44
14 SwiftyJSON 0x105c49ccc $s10SwiftyJSON0B0V10jsonObjectACyp_tc33_4625CC38AABF536BB76490A35D7233C9LlfCTf4nd_n + 164
15 SwiftyJSON 0x105c49f00 $s10SwiftyJSON0B0VyACypcfCTf4nd_n + 152
16 SwiftyJSON 0x105c381ac $s10SwiftyJSON0B0VyACypcfC + 28
17 MyApp 0x104d521e4 specialized NetworkManager.networkRequestResponseHandler(withResponse:completionHandler:retryHandler:) + 51 (NetworkManager.swift:51)
18 MyApp 0x104d51404 closure #1 in NetworkManager.fetchDeezerTracks(forAlbum:withAccessToken:withCompletionHandler:) + 4376810500
19 MyApp 0x104d50294 closure #1 in NetworkManager.fetchAppleMusicTracks(forAlbumID:withAccessToken:withCompletionHandler:) + 4376806036
20 Alamofire 0x105313e64 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5Tm + 132
21 Alamofire 0x105319d08 $s9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_AA0bkF0VyypG_Tg5TATm + 36
22 Alamofire 0x1052fb3b0 $sIeg_IeyB_TR + 28
23 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
24 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
25 libdispatch.dylib 0x1b2e8165c _dispatch_root_queue_drain + 640
26 libdispatch.dylib 0x1b2e81cd0 _dispatch_worker_thread2 + 112
27 libsystem_pthread.dylib 0x1b2eecb38 _pthread_wqthread + 212
28 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
com.google.fira.worker
com.google.fira.worker
0 libsqlite3.dylib 0x1b4df32a8 sqlite3_exec + 26552
1 libsqlite3.dylib 0x1b4dee810 sqlite3_exec + 7456
2 libsqlite3.dylib 0x1b4ded6fc sqlite3_exec + 3084
3 libsqlite3.dylib 0x1b4decc3c sqlite3_exec + 332
4 MyApp 0x104e1d0cc -[APMSqliteStore beginTransaction] + 4377645260
5 MyApp 0x104e1cf18 -[APMSqliteStore performTransactionWithError:block:] + 4377644824
6 MyApp 0x104dd9444 -[APMDatabase performTransaction:] + 4377367620
7 MyApp 0x104df2a5c -[APMMeasurement writeEventOnWorkerQueue:] + 4377471580
8 MyApp 0x104df2280 -[APMMeasurement handleEventOnWorkerQueue:] + 4377469568
9 MyApp 0x104df1500 __27-[APMMeasurement logEvent:]_block_invoke + 4377466112
10 MyApp 0x104e06f50 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 4377554768
11 libdispatch.dylib 0x1b2e9a9a8 _dispatch_call_block_and_release + 24
12 libdispatch.dylib 0x1b2e9b524 _dispatch_client_callout + 16
13 libdispatch.dylib 0x1b2e78b3c _dispatch_lane_serial_drain$VARIANT$armv81 + 564
14 libdispatch.dylib 0x1b2e7954c _dispatch_lane_invoke$VARIANT$armv81 + 396
15 libdispatch.dylib 0x1b2e8284c _dispatch_workloop_worker_thread + 580
16 libsystem_pthread.dylib 0x1b2eecb74 _pthread_wqthread + 272
17 libsystem_pthread.dylib 0x1b2eef740 start_wqthread + 8
(Just a guess)
This reeks of threading issues (you can get odd threading cashes if you try and access/manipulate the same object from different threads, and looking at your code you have escaping closures on escaping closures all over the place), looking through your crash log maybe it has something to do with the UserManager seeing: this UserManager._cachedSavedUsers.didset twice and UserManager._cachedActiveUser.didset too, always followed by some writes.
Even shows up on the thread labeled com.twitter.crashlytics.ios.MachExceptionServer but that could be for any reason, just suspicious given all this other stuff too and that crashlytics is your crash reporting tool..
App will definitely crash (intermittently) if there's some encoding / property manipulation happening on this user manager / an app-wide cache and its not being accessed in a thread safe way
I'm getting this error everytime my app starts :
Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]
PID: 5264, TID: 1948690, Thread name: (none), Queue name: NSOperationQueue 0x107c31d80 (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4 app 0x0000000104debcf4 -[FIRCLSReportManager captureInitialNotificationStates] + 144
5 app 0x0000000104deba88 -[FIRCLSReportManager setupStateNotifications] + 44
6 app 0x0000000104de9478 -[FIRCLSReportManager startCrashReporterWithProfilingMark:report:] + 256
7 app 0x0000000104de8210 -[FIRCLSReportManager startWithProfilingMark:] + 1188
8 app 0x0000000104e01be4 -[FIRCrashlytics initWithApp:appInfo:installations:analytics:] + 1448
9 app 0x0000000104e022e8 __38+[FIRCrashlytics componentsToRegister]_block_invoke + 532
10 app 0x0000000104daf8bc -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] + 132
11 app 0x0000000104dafb60 -[FIRComponentContainer instanceForProtocol:] + 344
12 app 0x0000000104db0234 +[FIRComponentType instanceForProtocol:inContainer:] + 104
13 app 0x0000000104e023d8 +[FIRCrashlytics crashlytics] + 136
14 app 0x0000000104923488 -[CrashReportingManager logWithFormat:arguments:] + 136
15 app 0x00000001049233e8 -[CrashReportingManager logWithFormat:] + 84
16 app 0x00000001049d6e4c __49-[AccountManager clearTempDataStorageCompletion:]_block_invoke + 636
17 Foundation 0x00000001b04a33a0 7B1733B1-74C9-3A33-8A58-853B0A029826 + 1131424
18 Foundation 0x00000001b03ad0c8 7B1733B1-74C9-3A33-8A58-853B0A029826 + 123080
19 Foundation 0x00000001b04a5628 7B1733B1-74C9-3A33-8A58-853B0A029826 + 1140264
20 Foundation 0x00000001b03acd60 7B1733B1-74C9-3A33-8A58-853B0A029826 + 122208
21 Foundation 0x00000001b04a6020 7B1733B1-74C9-3A33-8A58-853B0A029826 + 1142816
22 Foundation 0x00000001b04a5aec 7B1733B1-74C9-3A33-8A58-853B0A029826 + 1141484
23 libdispatch.dylib 0x0000000107a8d268 _dispatch_block_async_invoke2 + 104
24 libdispatch.dylib 0x0000000107a7ebd8 _dispatch_client_callout + 16
25 libdispatch.dylib 0x0000000107a817dc _dispatch_continuation_pop + 524
26 libdispatch.dylib 0x0000000107a80c5c _dispatch_async_redirect_invoke + 624
27 libdispatch.dylib 0x0000000107a90160 _dispatch_root_queue_drain + 376
28 libdispatch.dylib 0x0000000107a90a88 _dispatch_worker_thread2 + 156
29 libsystem_pthread.dylib 0x00000001afdfab48 _pthread_wqthread + 212
30 libsystem_pthread.dylib 0x00000001afdfd760 start_wqthread + 8
It seems Firebase is calling statusBarOrientation on a background thread ?
Is anyone else getting this or knows how to fix this ?
You are trying to access +[FIRCrashlytics crashlytics] on a non-main thread.
My iOS app had a crash caused by CFNetwork. I cannot reproduce it. The app was running on iOS 12. I am using Alamofire to perform HTTP requests, but I don't think it was caused by Alamofire. Anyone has any idea?
Crashed: com.apple.CFNetwork.Connection
0 libsystem_kernel.dylib 0x1ba289104 __pthread_kill + 8
1 libsystem_pthread.dylib 0x1ba308a00 pthread_kill$VARIANT$armv81 + 296
2 libsystem_c.dylib 0x1ba1e0d78 abort + 140
3 libsystem_c.dylib 0x1ba1ae67c basename_r + 314
4 CFNetwork 0x1bae63478 invocation function for block in TCPIOConnection::_tlsValidateServerTrust(nw_tls_context*) + 346
5 CFNetwork 0x1bae614e0 TCPIOConnection::_handleTLSEvent(nw_tls_context*, tls_handshake_message_t, void () block_pointer, bool) + 720
6 libnetwork.dylib 0x1bb8716b0 __tcp_connection_set_tls_message_handler_on_nw_connection_block_invoke + 168
7 libboringssl.dylib 0x1bb5e505c __boringssl_context_issue_tls_handshake_callback_block_invoke + 188
8 libdispatch.dylib 0x1ba12b6c8 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x1ba12c484 _dispatch_client_callout + 16
10 libdispatch.dylib 0x1ba106fb0 _dispatch_lane_serial_drain$VARIANT$armv81 + 548
11 libdispatch.dylib 0x1ba107b2c _dispatch_lane_invoke$VARIANT$armv81 + 468
12 libdispatch.dylib 0x1ba108d70 _dispatch_workloop_invoke$VARIANT$armv81 + 1892
13 libdispatch.dylib 0x1ba10ff14 _dispatch_workloop_worker_thread + 584
14 libsystem_pthread.dylib 0x1ba30e0f0 _pthread_wqthread + 312
15 libsystem_pthread.dylib 0x1ba310d00 start_wqthread + 4
I'm using VECTOR 0.6.17 and when I run my app in XCode 9.4, the app is running and chat is getting logged in correctly and the user's to whom I chatted previously is showing. When I click a particular user the app freezes and I can't do anything after that. I have attached the log.
2018-09-11 11:31:03.959131+0530 Vector[317:22327] [MXKRoomDataSource] paginateToFillRect: {{0, 0}, {414, 736}}
2018-09-11 11:31:03.959224+0530 Vector[317:22327] [MXKRoomDataSource] paginateToFillRect: Prefill with data from the store
2018-09-11 11:31:03.959321+0530 Vector[317:22327] [MXEventTimeline] paginate 30 messages in !eCuIjpMTkujUAaerDm:matrix.org (10 are retrieved from the store)
2018-09-11 11:31:03.960371+0530 Vector[317:22327] [MXEventTimeline] paginate : is done from the store
=================================================================
Main Thread Checker: UI API called on a background thread: -[UILabel setText:]
PID: 317, TID: 22759, Thread name: (none), Queue name: MXKRoomDataSource, QoS: 0
Backtrace:
4 Vector 0x0000000101216a6c +[AvatarGenerator imageFromText:withBackgroundColor:] + 480
5 Vector 0x0000000101217060 +[AvatarGenerator avatarForText:andColorIndex:] + 448
6 Vector 0x0000000101217268 +[AvatarGenerator generateAvatarForMatrixItem:withDisplayName:] + 188
7 Vector 0x000000010123c8d8 -[RoomBubbleCellData initWithEvent:andRoomState:andRoomDataSource:] + 348
8 Vector 0x0000000101471548 __41-[MXKRoomDataSource processQueuedEvents:]_block_invoke + 2092
9 libdispatch.dylib 0x00000001023591dc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x000000010235919c _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000102367dfc _dispatch_queue_serial_drain + 768
12 libdispatch.dylib 0x000000010235c6ac _dispatch_queue_invoke + 328
13 libdispatch.dylib 0x0000000102368d54 _dispatch_root_queue_drain_deferred_wlh + 352
14 libdispatch.dylib 0x000000010236fe38 _dispatch_workloop_worker_thread + 676
15 libsystem_pthread.dylib 0x000000018478be70 _pthread_wqthread + 860
16 libsystem_pthread.dylib 0x000000018478bb08 start_wqthread + 4
2018-09-11 11:31:03.981613+0530 Vector[317:22759] [reports] Main Thread Checker: UI API called on a background thread: -[UILabel setText:]
PID: 317, TID: 22759, Thread name: (none), Queue name: MXKRoomDataSource, QoS: 0
Backtrace:
4 Vector 0x0000000101216a6c +[AvatarGenerator imageFromText:withBackgroundColor:] + 480
5 Vector 0x0000000101217060 +[AvatarGenerator avatarForText:andColorIndex:] + 448
6 Vector 0x0000000101217268 +[AvatarGenerator generateAvatarForMatrixItem:withDisplayName:] + 188
7 Vector 0x000000010123c8d8 -[RoomBubbleCellData initWithEvent:andRoomState:andRoomDataSource:] + 348
8 Vector 0x0000000101471548 __41-[MXKRoomDataSource processQueuedEvents:]_block_invoke + 2092
9 libdispatch.dylib 0x00000001023591dc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x000000010235919c _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000102367dfc _dispatch_queue_serial_drain + 768
12 libdispatch.dylib 0x000000010235c6ac _dispatch_queue_invoke + 328
13 libdispatch.dylib 0x0000000102368d54 _dispatch_root_queue_drain_deferred_wlh + 352
14 libdispatch.dylib 0x000000010236fe38 _dispatch_workloop_worker_thread + 676
15 libsystem_pthread.dylib 0x000000018478be70 _pthread_wqthread + 860
16 libsystem_pthread.dylib 0x000000018478bb08 start_wqthread + 4
=================================================================
Main Thread Checker: UI API called on a background thread: -[UILabel setBackgroundColor:]
PID: 317, TID: 22759, Thread name: (none), Queue name: MXKRoomDataSource, QoS: 0
Backtrace:
4 Vector 0x0000000101216a84 +[AvatarGenerator imageFromText:withBackgroundColor:] + 504
5 Vector 0x0000000101217060 +[AvatarGenerator avatarForText:andColorIndex:] + 448
6 Vector 0x0000000101217268 +[AvatarGenerator generateAvatarForMatrixItem:withDisplayName:] + 188
7 Vector 0x000000010123c8d8 -[RoomBubbleCellData initWithEvent:andRoomState:andRoomDataSource:] + 348
8 Vector 0x0000000101471548 __41-[MXKRoomDataSource processQueuedEvents:]_block_invoke + 2092
9 libdispatch.dylib 0x00000001023591dc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x000000010235919c _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000102367dfc _dispatch_queue_serial_drain + 768
12 libdispatch.dylib 0x000000010235c6ac _dispatch_queue_invoke + 328
13 libdispatch.dylib 0x0000000102368d54 _dispatch_root_queue_drain_deferred_wlh + 352
14 libdispatch.dylib 0x000000010236fe38 _dispatch_workloop_worker_thread + 676
15 libsystem_pthread.dylib 0x000000018478be70 _pthread_wqthread + 860
16 libsystem_pthread.dylib 0x000000018478bb08 start_wqthread + 4
2018-09-11 11:31:04.088419+0530 Vector[317:22759] [reports] Main Thread Checker: UI API called on a background thread: -[UILabel setBackgroundColor:]
PID: 317, TID: 22759, Thread name: (none), Queue name: MXKRoomDataSource, QoS: 0
Backtrace:
4 Vector 0x0000000101216a84 +[AvatarGenerator imageFromText:withBackgroundColor:] + 504
5 Vector 0x0000000101217060 +[AvatarGenerator avatarForText:andColorIndex:] + 448
6 Vector 0x0000000101217268 +[AvatarGenerator generateAvatarForMatrixItem:withDisplayName:] + 188
7 Vector 0x000000010123c8d8 -[RoomBubbleCellData initWithEvent:andRoomState:andRoomDataSource:] + 348
8 Vector 0x0000000101471548 __41-[MXKRoomDataSource processQueuedEvents:]_block_invoke + 2092
9 libdispatch.dylib 0x00000001023591dc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x000000010235919c _dispatch_client_callout + 16
11 libdispatch.dylib 0x0000000102367dfc _dispatch_queue_serial_drain + 768
12 libdispatch.dylib 0x000000010235c6ac _dispatch_queue_invoke + 328
13 libdispatch.dylib 0x0000000102368d54 _dispatch_root_queue_drain_deferred_wlh + 352
14 libdispatch.dylib 0x000000010236fe38 _dispatch_workloop_worker_thread + 676
15 libsystem_pthread.dylib 0x000000018478be70 _pthread_wqthread + 860
16 libsystem_pthread.dylib 0x000000018478bb08 start_wqthread + 4
Can anyone help me with this issue please???
This is the link where the demo of the issue which I mentioned about,
https://www.dropbox.com/s/za69zs5yzlpdvvb/Vector%20Chat.mov?dl=0
In edit screen enabled pause on issues.
I got the issue at this place what to do for this issue?
As per #holex said I have added dispatch queue
again in that line same error came so added dispatch queue for that line also but my app gets crashed. I have attached the log also.
2018-09-11 13:15:35.113653+0530 Vector[412:50340] [MXLogger] handleUncaughtException:
4744231993351678525 - 2018-09-11 07:45:35 +0000
*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: R0)
Application: Vector (com.agriya.devtest)
Application version: 0.2.3 (r0.2.3)
Matrix SDK version: 0.6.17
Build: (no build info)
iPhone 11.4.1
Main thread: YES
(
0 CoreFoundation 0x0000000184b66da4 <redacted> + 252
1 libobjc.A.dylib 0x0000000183d205ec objc_exception_throw + 56
2 CoreFoundation 0x0000000184aff750 _CFArgv + 0
3 CoreFoundation 0x0000000184a34c6c <redacted> + 948
4 Vector 0x0000000100b030a0 +[AvatarGenerator avatarForText:andColorIndex:] + 528
5 Vector 0x0000000100b03258 +[AvatarGenerator generateAvatarForMatrixItem:withDisplayName:] + 188
6 Vector 0x0000000100b2b4c4 -[MXRoom(Vector) setRoomAvatarImageIn:] + 1224
7 Vector 0x0000000100b14554 -[RecentTableViewCell render:] + 3168
8 Vector 0x0000000100d0da4c -[MXKInterleavedRecentsDataSource tableView:cellForRowAtIndexPath:] + 440
9 Vector 0x0000000100b867f8 -[RecentsDataSource tableView:cellForRowAtIndexPath:] + 2876
10 UIKit 0x000000018e8430cc <redacted> + 668
11 UIKit 0x000000018e842d84 <redacted> + 80
12 UIKit 0x000000018e841aa0 <redacted> + 2280
13 UIKit 0x000000018e83d5ec <redacted> + 140
14 UIKit 0x000000018e77a6f4 <redacted> + 1420
15 QuartzCore 0x0000000188cefe54 <redacted> + 184
16 QuartzCore 0x0000000188cf3fe4 <redacted> + 324
17 QuartzCore 0x0000000188c606c8 <redacted> + 320
18 QuartzCore 0x0000000188c881b0 <redacted> + 580
19 QuartzCore 0x0000000188c89030 <redacted> + 92
20 CoreFoundation 0x0000000184b0e910 <redacted> + 32
21 CoreFoundation 0x0000000184b0c238 <redacted> + 412
22 CoreFoundation 0x0000000184b0c884 <redacted> + 1436
23 CoreFoundation 0x0000000184a2cda8 CFRunLoopRunSpecific + 552
24 GraphicsServices 0x0000000186a12020 GSEventRunModal + 100
25 UIKit 0x000000018ea4c758 UIApplicationMain + 236
26 Vector 0x0000000100b13508 main + 184
27 libdyld.dylib 0x00000001844bdfc0 <redacted> + 4
)
2018-09-11 13:15:35.144749+0530 Vector[412:50340] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: R0)'
*** First throw call stack:
(0x184b66d8c 0x183d205ec 0x184aff750 0x184a34c6c 0x100b030a0 0x100b03258 0x100b2b4c4 0x100b14554 0x100d0da4c 0x100b867f8 0x18e8430cc 0x18e842d84 0x18e841aa0 0x18e83d5ec 0x18e77a6f4 0x188cefe54 0x188cf3fe4 0x188c606c8 0x188c881b0 0x188c89030 0x184b0e910 0x184b0c238 0x184b0c884 0x184a2cda8 0x186a12020 0x18ea4c758 0x100b13508 0x1844bdfc0)
libc++abi.dylib: terminating with uncaught exception of type NSException