stream-chat-swift icon indicating copy to clipboard operation
stream-chat-swift copied to clipboard

Cannot Connects authorized user

Open heshamghalaab opened this issue 3 years ago • 1 comments

What did you do?

I am trying to Connects authorized user to getstream through this function public func connectUser(userInfo: UserInfo, token: Token, completion: ((Error?) -> Void)? = nil)

What did you expect to happen?

connecting successfully.

What happened instead?

App crash.

GetStream Environment

GetStream Chat version: 4.15.0 GetStream Chat frameworks: StreamChat, StreamChatUI iOS version: 15.3.1 Swift version: 5 Xcode version: 13.2.1 (13C100) Device: iPhone 12

Additional context

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x184d140bc)
  frame #0: 0x0000000184d140bc libswiftFoundation.dylib`static Foundation.Date._unconditionallyBridgeFromObjectiveC(Swift.Optional<__C.NSDate>) -> Foundation.Date + 52
 * frame #1: 0x0000000102319614 app`static CurrentChatUser.create(dto=0x000000014932aeb0, self=StreamChat.CurrentChatUser) at CurrentUserDTO.swift:202:29
  frame #2: 0x0000000102318a6c app`CurrentUserDTO.asModel(self=0x000000014932aeb0) at CurrentUserDTO.swift:168:53
  frame #3: 0x0000000102311370 app`closure #1 in CurrentChatUserController.createUserObserver($0=0x000000014932aeb0) at CurrentUserController.swift:285:22
  frame #4: 0x00000001023107fc app`thunk for @escaping @callee_guaranteed (@guaranteed CurrentUserDTO) -> (@owned CurrentChatUser, @error @owned Error) at <compiler-generated>:0
  frame #5: 0x0000000102312008 app`partial apply for thunk for @escaping @callee_guaranteed (@guaranteed CurrentUserDTO) -> (@owned CurrentChatUser, @error @owned Error) at <compiler-generated>:0
  frame #6: 0x00000001023bb678 app`ListChangeAggregator.controller(controller=0x00000001497d4ec0, anObject=0x000000014932aeb0, indexPath=2 indices, type=delete, newIndexPath=<invalid> (0x66), self=0x00000001497d6c80) at ListDatabaseObserver.swift:309:59
  frame #7: 0x0000000102364404 app`closure #1 in closure #1 in EntityDatabaseObserver.listenForRemoveAllDataNotifications(index=0, item=0x000000014932aeb0, self=0x00000001497d4a90) at EntityDatabaseObserver.swift:199:39
  frame #8: 0x0000000102364464 app`thunk for @callee_guaranteed (@unowned Int, @guaranteed B) -> (@error @owned Error) at <compiler-generated>:0
  frame #9: 0x0000000102364c08 app`partial apply for thunk for @callee_guaranteed (@unowned Int, @guaranteed B) -> (@error @owned Error) at <compiler-generated>:0
  frame #10: 0x0000000185142284 libswiftCore.dylib`Swift.Sequence.forEach((τ_0_0.Element) throws -> ()) throws -> () + 748
  frame #11: 0x0000000102363e04 app`closure #1 in EntityDatabaseObserver.listenForRemoveAllDataNotifications(_0=<unavailable>, self=0x00000001497d4a90) at EntityDatabaseObserver.swift:198:51
  frame #12: 0x0000000100c30f28 app`thunk for @escaping @callee_guaranteed (@in_guaranteed Notification) -> () at <compiler-generated>:0
  frame #13: 0x0000000181e75c00 Foundation`-[__NSObserver _doit:] + 348
  frame #14: 0x0000000180646f88 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
  frame #15: 0x00000001806e2c3c CoreFoundation`___CFXRegistrationPost_block_invoke + 52
  frame #16: 0x00000001806b5ff4 CoreFoundation`_CFXRegistrationPost + 456
  frame #17: 0x000000018065cdf4 CoreFoundation`_CFXNotificationPost + 716
  frame #18: 0x000000010232be98 app`closure #1 in closure #1 in DatabaseContainer.sendNotificationForAllContexts($0=0x0000000147997ca0, name=<no summary available>) at DatabaseContainer.swift:264:44
  frame #19: 0x000000010232bed4 app`thunk for @callee_guaranteed (@guaranteed NSManagedObjectContext) -> (@error @owned Error) at <compiler-generated>:0
  frame #20: 0x000000010232f568 app`partial apply for thunk for @callee_guaranteed (@guaranteed NSManagedObjectContext) -> (@error @owned Error) at <compiler-generated>:0
  frame #21: 0x0000000185142284 libswiftCore.dylib`Swift.Sequence.forEach((τ_0_0.Element) throws -> ()) throws -> () + 748
  frame #22: 0x000000010232bd60 app`closure #1 in DatabaseContainer.sendNotificationForAllContexts(self=0x0000000147d3a280, name=<no summary available>) at DatabaseContainer.swift:263:24
  frame #23: 0x00000001023c8c7c app`closure #1 in static OS_dispatch_queue.performSynchronouslyOnMainQueue(action=0x000000010232f538 app`partial apply forwarder for closure #1 () -> () in StreamChat.DatabaseContainer.sendNotificationForAllContexts(name: __C.NSNotificationName) -> () at <compiler-generated>) at MainQueue+Synchronous.swift:18:21
  frame #24: 0x00000001023c8cd0 app`partial apply for closure #1 in static OS_dispatch_queue.performSynchronouslyOnMainQueue(_:) at <compiler-generated>:0
  frame #25: 0x00000001024c8fa4 app`thunk for @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
  frame #26: 0x00000001023c8cf8 app`partial apply for thunk for @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0
  frame #27: 0x0000000199d5b938 libswiftDispatch.dylib`partial apply forwarder for reabstraction thunk helper <τ_0_0> from @callee_guaranteed () -> (@out τ_0_0, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out τ_0_0, @error @owned Swift.Error) + 28
  frame #28: 0x0000000199d62c18 libswiftDispatch.dylib`reabstraction thunk helper <τ_0_0> from @callee_guaranteed () -> (@out τ_0_0, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out τ_0_0, @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".50" + 16
  frame #29: 0x0000000199d5cc70 libswiftDispatch.dylib`closure #1 () -> () in closure #1 (() throws -> τ_0_0) -> () in __C.OS_dispatch_queue._syncHelper<τ_0_0>(fn: (() -> ()) -> (), execute: () throws -> τ_0_0, rescue: (Swift.Error) throws -> τ_0_0) throws -> τ_0_0 + 188
  frame #30: 0x0000000199d5cd5c libswiftDispatch.dylib`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 28
  frame #31: 0x0000000199d5c680 libswiftDispatch.dylib`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @callee_unowned @convention(block) () -> () + 28
  frame #32: 0x000000010c7663b4 libdispatch.dylib`_dispatch_client_callout + 20
  frame #33: 0x000000010c777a88 libdispatch.dylib`_dispatch_async_and_wait_invoke + 220
  frame #34: 0x000000010c7663b4 libdispatch.dylib`_dispatch_client_callout + 20
  frame #35: 0x000000010c776898 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1224
  frame #36: 0x000000018066dd84 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
  frame #37: 0x0000000180627f5c CoreFoundation`__CFRunLoopRun + 2540
  frame #38: 0x000000018063b468 CoreFoundation`CFRunLoopRunSpecific + 600
  frame #39: 0x000000019c1df38c GraphicsServices`GSEventRunModal + 164
  frame #40: 0x0000000182fde5d0 UIKitCore`-[UIApplication _run] + 1100
  frame #41: 0x0000000182d5cf74 UIKitCore`UIApplicationMain + 364
  frame #42: 0x000000010106f500 app`main at EVAppDelegate.swift:38:11
  frame #43: 0x000000010c3c5aa4 dyld`start + 520

heshamghalaab avatar Aug 08 '22 16:08 heshamghalaab

Hi @heshamghalaab,

Thanks for your report. We've previously faced a similar crash before and was fixed. I recommend you to update the SDK to the latest version and also to review our docs regarding how to connect a user to check that your implementation is aligned.

If this don't solve the crash, please provide further information on your implementation so we can provide more asistance.

Regards, Hugo

hugobernalstream avatar Aug 08 '22 17:08 hugobernalstream

Hi @heshamghalaab!

I'm closing this issue for inactivity, let us know if you have further questions.

Best, Nuno

nuno-vieira avatar Aug 16 '22 14:08 nuno-vieira