clevertap-flutter icon indicating copy to clipboard operation
clevertap-flutter copied to clipboard

Getting warning regarding platform channel in ios

Open ShashankSMayya opened this issue 1 year ago • 4 comments

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
    }


ShashankSMayya avatar Aug 28 '23 07:08 ShashankSMayya

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.

nishant-clevertap avatar Aug 28 '23 10:08 nishant-clevertap

any update ?

i got same issues

  1. Are you getting this warning during App launch or any custom steps?
  • app launch
  1. 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.

rifdi123 avatar Mar 27 '24 09:03 rifdi123

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

nishant-clevertap avatar Mar 28 '24 11:03 nishant-clevertap

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

nishant-clevertap avatar May 29 '24 07:05 nishant-clevertap

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

nishant-clevertap avatar Sep 04 '24 06:09 nishant-clevertap