fayeed / flutter_freshchat

The unofficial flutter plugin for Freshchat
https://pub.dartlang.org/packages/flutter_freshchat
MIT License
32 stars 36 forks source link

[BUG] Crash in iOS when calling FlutterFreshchat #31

Closed mohdkhmais closed 4 years ago

mohdkhmais commented 4 years ago

Describe the bug When you open the app for the first time it crashes with this error below. ( I am using flutter_freshchat version 1.2.6)

Desktop (please complete the following information):

Flutter doctor -v

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.2 19C57, locale en-BH) • Flutter version 1.12.13+hotfix.8 at /Users/dev/development/flutter • Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at /Users/dev/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3, Build version 11C29 • CocoaPods version 1.9.0

[!] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.42.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.8.1

[✓] Connected device (1 available) • iPhone 11 • B60011B4-308E-4228-B0E3-ED5091980954 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

! Doctor found issues in 2 categories. ITs-MacBook-Air:homiez-mobile dev$

Additional context Launching lib/main.dart on iPhone 11 in debug mode... Xcode build done. 94.7s path: satisfied (Path is satisfied), interface: en0 Configuring the default Firebase app... path: satisfied (Path is satisfied), interface: en0 Configured the default Firebase app __FIRAPP_DEFAULT. path: satisfied (Path is satisfied), interface: en0 path: satisfied (Path is satisfied), interface: en0 [C4.1 8C472F77-CA5E-4E2B-99A0-B30318B4A2DA 192.168.100.60:60991<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.364s, DNS @0.001s took 0.007s, TCP @0.010s took 0.036s, TLS took 0.166s bytes in/out: 4370/1117, packets in/out: 8/10, rtt: 0.029s, retransmitted packets: 0, out-of-order packets: 0 [C5.1 AA781AED-06EC-4E96-A886-FEF7E3017F5D 192.168.100.60:60992<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.402s, DNS @0.002s took 0.005s, TCP @0.009s took 0.040s, TLS took 0.207s bytes in/out: 4732/1022, packets in/out: 8/9, rtt: 0.034s, retransmitted packets: 0, out-of-order packets: 0 [C6.1 64032EE7-57BF-4699-BF46-0B3EEB523365 192.168.100.60:60993<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.338s, DNS @0.001s took 0.004s, TCP @0.007s took 0.033s, TLS took 0.159s bytes in/out: 4242/1464, packets in/out: 8/10, rtt: 0.028s, retransmitted packets: 0, out-of-order packets: 0 flutter: {deviceid: E5AC360A-D9FF-450D-AC2F-2D22E80FE2A2, os: iOS, systemversion: 13.3, mobile: iPhone 11, version: 2.3.8, buildNumber: 0.0.0} path: satisfied (Path is satisfied), interface: en0 [C7.1 0D81BD57-304C-4CDA-9197-E873CE0B392E 192.168.100.60:61020<->172.217.19.14:443] Connected Path: satisfied (Path is satisfied), interface: en0 Duration: 0.395s, DNS @0.002s took 0.004s, TCP @0.008s took 0.036s, TLS took 0.211s bytes in/out: 4242/1406, packets in/out: 8/10, rtt: 0.029s, retransmitted packets: 0, out-of-order packets: 0 Lost connection to device. *** First throw call stack:

(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23c91ed4 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
    4   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
    5   flutter_freshchat                   0x000000010d3b072d -[FDWebImageDownloaderOperation URLSession:task:didCompleteWithError:] + 476
    6   flutter_freshchat                   0x000000010d41a266 -[FDWebImageDownloader URLSession:task:didCompleteWithError:] + 113
    7   CFNetwork                           0x00007fff22f31884 _CFNetworkHTTPConnectionCacheSetL<…>
nimi0112 commented 4 years ago

Hi, @mohdkhmais did you resolve this issue? I am also facing this

mohdkhmais commented 4 years ago

Hi @nimi0112 still i am waiting for @fayeed to replay. I tried contacting him on email and here still no luck. I need the fix also for my company app. I tried myself to investigate through the code but no luck because i am not familiar with swift. Hope @fayeed can fix it asap.

nimi0112 commented 4 years ago

Steps to reproduce:

  1. Clone the sample app.
  2. Replace your Feshchat API keys.
  3. Run the iOS app in the simulator or real device.
  4. Update user info in the app.
  5. Select show conversation.
  6. Send a message to the dashboard.
  7. Reply to the message from the dashboard and the app crashes.
  8. Open the show conversation screen again and the app again crashes.

I also have allowed notification permission then also it crashes.

It does not crash on Android only crashes on iOS.

mohdkhmais commented 4 years ago

@nimi0112 even if you are using auto message (when you set auto message when you are not in office time) you will have a crash whenever you receive a message from the agent.

rahuldange09 commented 4 years ago

Anyone resolved this issue? any changes?

mohdkhmais commented 4 years ago

@rahuldange09 no still waiting i tried contacting him via email no response..

fayeed commented 4 years ago

I have updated the package to 1.3.0. Check if this resolves the issue and let me know.

mohdkhmais commented 4 years ago

Hi @fayeed I updated the version but i am getting this from xcode `error: include of non-modular header inside framework module 'flutter_freshchat.FlutterFreshchatPlugin': '/Users/dev/Desktop/flutterApps/homiez-mobile/ios/Pods/FreshchatSDK/FreshchatSDK/FreshchatSDK.h'

import "FreshchatSDK.h"

    ^
:0: error: could not build Objective-C module 'flutter_freshchat'`
mohdkhmais commented 4 years ago

@fayeed Here's a screenshot Image

rahuldange09 commented 4 years ago

@fayeed thanks for updating package. We really appreciate your efforts. As @mohdkhmais mentioned I'm also facing same error. Can you please help with it and fix this error.

And just to mention v1.2.6 and before we used to get force closes specially on FAQ screen. It was related to some UIImage thing as It was only causing when there was FAQ data but if its empty then it wasn't force closing.

rahuldange09 commented 4 years ago

@fayeed Here's a screenshot Image

@mohdkhmais You got any solution on this?

mohdkhmais commented 4 years ago

@rahuldange09 still waiting for @fayeed

lessthanno commented 4 years ago

I made a version comparison https://github.com/fayeed/flutter_freshchat/issues/34

rahuldange09 commented 4 years ago

I got a workaround for this issue on latest version 1.3.0. Note : This will not work if you want to debug app. And Great thanks to @fayeed. This version does not cause any problem with app. No force closes nothing at all.

Steps:

  1. Update to 1.3.0

  2. Flutter clean (optional)

  3. Open terminal in your app folder then cd ios then pod install

  4. Open Xcode and in Left side panel

  5. In that panel click on this file "FreshchatSDK.h" (Check image below) image

  6. On right side. Click on flutter_freshchat and change Project to Public (If panel not open click on top corner last open to open panel) image

  7. Now Go to File > Workspace Setting Then In Shared Workspace Setting select Legacy Build System. image

  8. Now Run it from Xcode only. You can directly run from ▶️ this which will run as debug mode. Which can pause app if error. You can continue that. Or best is to From Product > Profile (Or edit scheme for debug as Release)

  9. If XCode shows any error in "SwiftFlutterFreshchatPlugin.swift" file then replace code by this https://gist.github.com/rahuldange09/c551c310f1696b3e1f4a6eaba9d77b6c

  10. Now run it should work. (If any issue try step 2 and 3 again)

Note : As this will only work from xcode and its Temporary workaround. If you run using flutter tool then changes of step 7 will revert back. In that case just do Step 7 again and done.

If you want to debug run with flutter tool then you have to change back again to 1.2.6 do pod install and use that. But when its release or something do this steps.

lessthanno commented 4 years ago

It's fixed https://github.com/fayeed/flutter_freshchat/issues/34#issuecomment-618804254

rahuldange09 commented 4 years ago

It's fixed #34 (comment)

I tried that. It still has force close issue.

mohdkhmais commented 4 years ago

@rahuldange09 I tried it and it works. Many thanks to @rahuldange09 , @fayeed and all others.

mohdkhmais commented 4 years ago

@rahuldange09 i am getting this while trying to archive the app , checkout the screenshot

rahuldange09 commented 4 years ago

@rahuldange09 i am getting this while trying to archive the app , checkout the screenshot

Make it public again and make sure u have legacy build system selected Step 6 and 7

mohdkhmais commented 4 years ago

Hi @rahuldange09 ,

Thank you it is working.

jun1044896742 commented 4 years ago

Hi @rahuldange09 ,

Thank you it is working.

nimi0112 commented 4 years ago

@mohdkhmais @rahuldange09 @fayeed Not Working for me. It is giving this error:

Screenshot 2020-06-05 at 7 54 37 AM
rahuldange09 commented 4 years ago

@mohdkhmais @rahuldange09 @fayeed Not Working for me. It is giving this error:

Screenshot 2020-06-05 at 7 54 37 AM

Which flutter sdk version u using?

shredding commented 4 years ago

How temporary is this temporary workaround? I'm quite reluctant to change the build system.

jun1044896742 commented 4 years ago

@mohdkhmais @rahuldange09 @fayeed Not Working for me. It is giving this error:

Screenshot 2020-06-05 at 7 54 37 AM

Update to 1.3.0 ,not 1.3.1

jun1044896742 commented 4 years ago

@mohdkhmais @rahuldange09 @fayeed Not Working for me. It is giving this error:

Screenshot 2020-06-05 at 7 54 37 AM

Which flutter sdk version u using?

Update to 1.3.0 ,not 1.3.1