simple_auth_flutter on ios AppDelegate.swift import change fails to start

Viewed 332

I would like to use simple_auth_flutter into my FLutter app to authenticate user against instagram. So I followed the documentation page and applied all changes. I try to add the mentioned lines into my AppDelegate.swift as below:

import UIKit
import Flutter
import SimpleAuth;

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
    override func application(_ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey : Any]?) -> Bool{
        return SimpleAuth.CheckUrl(url);
    }
}

When I try to execute flutter run I see the error:

no such module 'SimpleAuth' import SimpleAuth;

So what should I do to solve the import in the AppDelegate? My pubspec.yml uses:

simple_auth: ^2.0.7
simple_auth_flutter: ^2.0.7
1 Answers

I think i've found a solution that allows my app to build.

import UIKit
import Flutter
import simple_auth_flutter;

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

   override func application(_ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey : Any]?) -> Bool{
        return SimpleAuthFlutterPlugin.check(url);
    }
}
Related