Skip to content

print statement doesnt work in ios native plugin #28856

Closed

Description

@shyandsy

I am writting the native plugin code for ios, but the print statement doesnt work, and the breakpoint even no work.

I notice there only one print work located in

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    print("Before\nAfter\n")  // here
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Activity

  1. added
    engine
    on Apr 2, 2019
  2. added this to the milestone on Apr 2, 2019
  3. nilobarp commented on May 22, 2019

    @nilobarp

    Having the same issue. Tried with NSLog, also added a new line to it (#13204) but flutter console doesn't show the logs. It is worth mentioning that this is in a plugin project.

  4. lukepighetti commented on Aug 26, 2019

    @lukepighetti
    Contributor

    I'm unable to get any kind of output to flutter console. Requesting an explicit method on FlutterViewController #39240

  5. added
    P2
    on May 29, 2020
  6. removed this from the milestone on Aug 17, 2020
  7. TahaTesser commented on Oct 22, 2020

    @TahaTesser
    Contributor

    Hi @shyandsy
    this is fixed #13204 (comment) #13204 (comment)

    import Flutter
    import UIKit
    
    public class SwiftHelloBetaPlugin: NSObject, FlutterPlugin {
      public static func register(with registrar: FlutterPluginRegistrar) {
        let channel = FlutterMethodChannel(name: "hello_beta", binaryMessenger: registrar.messenger())
        let instance = SwiftHelloBetaPlugin()
        registrar.addMethodCallDelegate(instance, channel: channel)
      }
    
      public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
         print("hi!")
        NSLog("Before\nAfter")
        NSLog("\nHello, World!")
        result("iOS " + UIDevice.current.systemVersion)
      }
    }
    
    

    Closing as duplicate of #28856

  8. github-actions commented on Aug 10, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions