zoho / SalesIQ-Mobilisten-iOS

Your mobile app's ideal live chat partner. Power up your iOS App with the SalesIQ Mobilisten iOS SDK.
https://mobilisten.io
11 stars 4 forks source link

SDK Crash in any moment #11

Closed julioarregoitia closed 4 years ago

julioarregoitia commented 4 years ago

Describe the bug The bug is because a Multithreading Core Data Violation, I explain you more. Around 6 month ago I just started to test my app using the flag of Xcode to Multithreading Core Data Violation. And I found with early versions (all Betas) of your SDK that issue was happening. Today I updated to the Release 3.0 and I found the same issue. It's very simple to reproduce.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Edith Scheme', then Arguments and put this on the list: -com.apple.CoreData.ConcurrencyDebug 1 . Be sure that the checkmark is marked

  2. Hide the Default Button and use a custom one. In my code I only use the next line:

In AppDelegate.swift in the method application(_:didFinishLaunchingWithOptions:)

        ZohoSalesIQ.initWithAppKey("<MY APP KEY>", accessKey: "<MY ACCESS KEY>") { (success) in
            print(success)
        }
        ZohoSalesIQ.showLauncher(false)
  1. In my ViewController I am using only this function in a IBAction func : ZohoSalesIQ.Chat.show()
  2. Open the chat conversation and wait to the response of the agent and then... Kaboom

Expected behavior Easy. Don't crash. Because this crash can appear in any moment in Production

Screenshots You can see on the Thread 2, on the row with number 0, the flag of Xcode belong to Multithreading Violation Captura de Pantalla 2020-06-27 a la(s) 9 51 33 p  m

Smartphone (please complete the following information):

Additional context As additional information, I have to say that I am using this functions, accessing to them on the MainThread:

                ZohoSalesIQ.Visitor.setName(<THE NAME>)
                ZohoSalesIQ.Visitor.setEmail(<THE EMAIL>)
                ZohoSalesIQ.Visitor.setContactNumber(<THE PHONE NUMBER>)

Pd: Sorry by my English.

Rishabh-Raghunath commented 4 years ago

Thanks for the detailed report. We'll look into this and keep you posted.

julioarregoitia commented 4 years ago

Thanks to you. Best regards

kohlidevils commented 4 years ago

We have faced this crash on prod, here's the stack trace: Crashed: NSOperationQueue 0x109969ab0 (QOS: UNSPECIFIED) 0 Mobilisten 0x101fec5a4 hidden#5478 + 191 (hidden#18276_:191) 1 Mobilisten 0x101fed3e4 hidden#9291 + 69 (_hidden#18276:69) 2 Mobilisten 0x101f31e0c hidden#5437 + 39 (hidden#5359_:39) 3 Mobilisten 0x101ef88cc hidden#5486 + 57 (hidden#5627_:57) 4 Mobilisten 0x101ef51a4 hidden#5418 + 4392751524 (_hidden#4240:4392751524) 5 MyApp 0x100e5024c InstrumentSendAsynchronousRequestQueueCompletionHandler_block_invoke_2 + 4375364172 6 CFNetwork 0x186587f1c _CFURLConnectionCopyTimingData + 19336 7 Foundation 0x183603cfc NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 24 8 Foundation 0x183505c3c -[NSBlockOperation main] + 104 9 Foundation 0x18360603c __NSOPERATION_IS_INVOKING_MAIN + 24 10 Foundation 0x183505914 -[NSOperation start] + 752 11 Foundation 0x183606a68 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 24 12 Foundation 0x183606528 NSOQSchedule_f + 184 13 libdispatch.dylib 0x182edcdb4 _dispatch_block_async_invoke2 + 144 14 libdispatch.dylib 0x182ed033c _dispatch_client_callout + 20 15 libdispatch.dylib 0x182ed2af8 _dispatch_continuation_pop + 408 16 libdispatch.dylib 0x182ed2258 _dispatch_async_redirect_invoke + 588 17 libdispatch.dylib 0x182edf5c0 _dispatch_root_queue_drain + 348 18 libdispatch.dylib 0x182edfd9c _dispatch_worker_thread2 + 116 19 libsystem_pthread.dylib 0x182f376d8 _pthread_wqthread + 216 20 libsystem_pthread.dylib 0x182f3d9c8 start_wqthread + 8

julioarregoitia commented 4 years ago

Yes, we have also presented that crash in Production. I just didn't present it here because that sample is much less understandable and that's why I exposed the one I wrote above

Rishabh-Raghunath commented 4 years ago

We have handled most, if not all cases of CoreData concurrency violations with the latest release after testing with com.apple.CoreData.ConcurrencyDebug 1 set in the scheme. Please give version 3.1.0 or above a go depending on the version of Xcode used to check this. We will be constantly improving this with newer releases.

julioarregoitia commented 4 years ago

So far so good. Thanks for the hard work. Best regards