CleverTap / clevertap-flutter

CleverTap Flutter SDK
Other
30 stars 43 forks source link

Getting warning regarding platform channel in ios #199

Closed ShashankSMayya closed 1 month ago

ShashankSMayya commented 1 year ago

While running the project in ios (I tried from simulator) I get this console output regarding Clevertap.

The 'clevertap_plugin/native_to_dart' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel

Clevertap Version: clevertap_plugin: ^1.8.1

import UIKit
import Flutter
import GoogleMaps
import CleverTapSDK
import clevertap_plugin

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {

  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    CleverTap.autoIntegrate()
    registerForPush()
    CleverTapPlugin.sharedInstance()?.applicationDidLaunch(options: launchOptions)

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  func registerForPush() {
        UNUserNotificationCenter.current().delegate = self
    }

    override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
      completionHandler([.sound, .alert, .badge])
    }

}

 public func shouldHandleCleverTap(_ url: URL?, for channel: CleverTapChannel) -> Bool {
//        print("Handling URL: \(url!) for channel: \(channel)")
        return true
    }
nishant-clevertap commented 1 year ago

Hi @ShashankSMayya,

Can you please provide some more details on this -

  1. Are you getting this warning during App launch or any custom steps?
  2. Can you provide steps which will reproduce this warning, also provide full console logs with debug enabled to investigate it.
rifdi123 commented 6 months ago

any update ?

i got same issues

  1. Are you getting this warning during App launch or any custom steps?
    • app launch
  2. Can you provide steps which will reproduce this warning, also provide full console logs with debug enabled to investigate it.
    • launch the apps

Launching lib/main.dart on iPhone 15 Pro Max in debug mode... Xcode build done. 29.1s [ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend. [ERROR:flutter/shell/common/shell.cc(1015)] The 'clevertap_plugin/native_to_dart' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel. See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

nishant-clevertap commented 6 months ago

Hi @rifdi123, Which flutter version are you using? Also Is this a warning or build error?

nishant-clevertap commented 4 months ago

Hi @rifdi123 @ShashankSMayya We are working on this. We will update you when new version will be released with the fix.

nishant-clevertap commented 1 month ago

The fix for this has been released on our latest v2.4.1. Please update to our latest version: https://github.com/CleverTap/clevertap-flutter/releases/tag/2.4.1