0
votes

I am trying to follow the instructions for using this package simple auth for flutter https://pub.dev/packages/simple_auth_flutter and I supposed to add this code to delegate.m but I can only find delegate.swift

// part of the code
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    return [SimpleAuthFlutterPlugin checkUrl:url];
}

I converted the code to swift using a website converter but I got this error *This is part of the error

warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner') /Users/loly/soul-project/sp_app/ios/Runner/AppDelegate.swift:16:10: error: overriding declaration requires an 'override' keyword func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { ^ override Flutter.FlutterAppDelegate:20:15: note: overridden declaration is here open func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool ^

1

1 Answers

1
votes

The code snippet is from objective c. You will either have to write your project in objective c or use a bridging header file to expose objective c code to your swift project. After you have exposed it to your swift project, you use the following example snippet from the authors github repo.

https://github.com/Clancey/simple_auth/blob/master/simple_auth_flutter/example/ios/Runner/AppDelegate.swift

import UIKit
import Flutter

@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)
  }
}

Hope this helps you to move forward :)