Monday, October 16, 2023
HomeiOS Developmentios - methods to look ahead to callback perform consequence, name didFinishLaunchingWithOptions...

ios – methods to look ahead to callback perform consequence, name didFinishLaunchingWithOptions from swift and ship the consequence to flutter?


I am engaged on flutter software mission,
I am utilizing pianoid sdk for social join, I created the callback methodology from IOS and sended the consequence to flutter, however within the first attempt it sends me a null worth , the second attempt works positive it ship me the token and I would like to resolve this subject.
I have to name didFinishLaunchingWithOptions once I get the consequence from the callback perform,
that is my code with swift :

@objc class AppDelegate: FlutterAppDelegate, PianoIDDelegate {
  personal var eventSink: FlutterEventSink?
      @Printed personal(set) var initialized = false
      @Printed personal(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) {}
  
  //  personal var mainCoordinator: AppCoordinator?
  override func software(_ software: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      
      GeneratedPluginRegistrant.register(with: self)
      let identify = Bundle.fundamental.infoDictionary?["CFBundleName"]
      let model = Bundle.fundamental.infoDictionary?["CFBundleShortVersionString"]
      
      GEMConfig.sharedInstance().setAppInfo(identify as? String, model: model as? String)
      //FirebaseApp.configure()
      guard let controller = window?.rootViewController as? FlutterViewController else {
            fatalError("rootViewController is just not sort FlutterViewController")
          }
      let Channel = FlutterMethodChannel(identify: "flutter.native/helper", binaryMessenger: controller.binaryMessenger)
      Channel.setMethodCallHandler({
          [weak self] (name: FlutterMethodCall, consequence: 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.software(software, didFinishLaunchingWithOptions: launchOptions)
              PianoID.shared.signIn()
              consequence(self!.token?.accessToken )
          } else {
              consequence(FlutterMethodNotImplemented)
          }
      })
      return tremendous.software(software, didFinishLaunchingWithOptions: launchOptions)
  }
  /// Signal In callback
         func signIn(consequence: PianoIDSignInResult!, withError error: Error!) {
             if let r = consequence {
                 token = r.token
                 print("please token", token!.expirationDate)
                 
                 
             } else {
             }
         }
         /// Signal Out callback
         func signOut(withError error: Error!) {
             token = nil
         }
         /// Cancel callback
         func cancel() {
         } ```



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments