Tuesday, October 6, 2026
HomeiOS Developmentios - find out how to look forward to callback operate outcome,...

ios – find out how to look forward to callback operate outcome, name didFinishLaunchingWithOptions from swift and ship the outcome to flutter?

[ad_1]

I am engaged on flutter utility challenge,
I am utilizing pianoid sdk for social join, I created the callback methodology from IOS and sended the outcome to flutter, however within the first strive it sends me a null worth , the second strive works high quality it ship me the token and I want to resolve this difficulty.
I have to name didFinishLaunchingWithOptions once I get the outcome from the callback operate,
that is my code with swift :

@objc class AppDelegate: FlutterAppDelegate, PianoIDDelegate {
  non-public var eventSink: FlutterEventSink?
      @Revealed non-public(set) var initialized = false
      @Revealed non-public(set) var token: PianoIDToken?
  var cookiessseion = ""
  var startdate = ""
  var enddate = ""
  var pianoToken=""
  func pianoID(_ pianoID: PianoOAuth.PianoID, didSignInForToken token: PianoOAuth.PianoIDToken!, withError error: Error!) {}
      func pianoID(_ pianoID: PianoOAuth.PianoID, didSignOutWithError error: Error!) {}
      func pianoIDSignInDidCancel(_ pianoID: PianoOAuth.PianoID) {}
  
  //  non-public var mainCoordinator: AppCoordinator?
  override func utility(_ utility: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      
      GeneratedPluginRegistrant.register(with: self)
      let title = Bundle.important.infoDictionary?["CFBundleName"]
      let model = Bundle.important.infoDictionary?["CFBundleShortVersionString"]
      
      GEMConfig.sharedInstance().setAppInfo(title as? String, model: model as? String)
      //FirebaseApp.configure()
      guard let controller = window?.rootViewController as? FlutterViewController else {
            fatalError("rootViewController is just not kind FlutterViewController")
          }
      let Channel = FlutterMethodChannel(title: "flutter.native/helper", binaryMessenger: controller.binaryMessenger)
      Channel.setMethodCallHandler({
          [weak self] (name: FlutterMethodCall, outcome: FlutterResult) -> Void in
          // Be aware: this methodology is invoked on the UI thread.
            if(name.methodology == "testpiano"){
              PianoID.shared.endpointUrl = Settings.endpoint.api
                      PianoID.shared.assist = Settings.assist
                      PianoID.shared.googleClientId = googleClientId
                      PianoID.shared.delegate = self
                          
                      PianoOAuth.PianoIDApplicationDelegate.shared.utility(utility, didFinishLaunchingWithOptions: launchOptions)
              PianoID.shared.signIn()
              outcome(self!.token?.accessToken )
          } else {
              outcome(FlutterMethodNotImplemented)
          }
      })
      return tremendous.utility(utility, didFinishLaunchingWithOptions: launchOptions)
  }
  /// Signal In callback
         func signIn(outcome: PianoIDSignInResult!, withError error: Error!) {
             if let r = outcome {
                 token = r.token
                 print("please token", token!.expirationDate)
                 
                 
             } else {
             }
         }
         /// Signal Out callback
         func signOut(withError error: Error!) {
             token = nil
         }
         /// Cancel callback
         func cancel() {
         } ```

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments