-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not able to build iOS app in flutter project #85
Comments
this is the error I am getting everytime. |
@phantumcode please help me with this problem. I am still stuck on this issue. you help will save me lot of time and effort. |
@Robopicker Thanks for submitting your issue. In regards to your question:
For integrating native components in a Flutter app, please reference the following documentation: |
@phantumcode Thanks for the info. I was able to successfully integrate aws amplify face verification. closing this issue. |
hi @Robopicker, I am late to the issue but I am struggling when integrating this project to flutter app. Can you please provide an example or a guide to make this happen. I aware of this project doesn't support Cocoapods and what I have tried is turning this project to a Cocoapods project then tried to put it to a flutter plugin, but not working. I have tried to compile this project to xcframework which can be used in a fresh Cocoapods project to integrate to flutter app but still cannot figure out a way to make this happen. |
@Linkadi98 Thanks for reaching out. I am sharing a code snippet for the Aws Verification controller and AppDelegate file. this code will help out. Keep in mind that you first need to generate a session ID through your backend services and pass that session ID through the flutter channel to the native side. Do let me know if you need further help. AppDelegate file :- import UIKit
import Flutter
import Amplify
import AWSCognitoAuthPlugin
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
do {
try Amplify.add(plugin: AWSCognitoAuthPlugin())
try Amplify.configure()
print("Amplify configured with auth plugin")
} catch {
print("Failed to initialize Amplify with \(error)")
}
let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
let methodChannel = FlutterMethodChannel(name: "LIVE_VERIFICATION_CHANNEL", binaryMessenger: controller.binaryMessenger)
methodChannel.setMethodCallHandler { [weak self] (call, result) in
if call.method == "startLiveVerification" {
guard let args = call.arguments as? [String: Any],
let sessionId = args["sessionId"] as? String else {
result(FlutterError(code: "INVALID_ARGUMENT", message: "Invalid session Id",details: nil))
return
}
print("session id is \(sessionId)")
let faceLivenessController = FaceLiveDetectionController()
faceLivenessController.sessionId = sessionId
faceLivenessController.flutterResult = result
faceLivenessController.modalPresentationStyle = .fullScreen
controller.present(faceLivenessController,
animated: true,
completion: nil)
} else {
result(FlutterMethodNotImplemented)
}
}
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
} FaceLivenessController :- //
// FaceLiveDetectionController.swift
// Runner
//
// Created by Yogesh on 05/12/23.
//
import Foundation
import SwiftUI
import UIKit
import FaceLiveness
class FaceLiveDetectionController: UIViewController {
var sessionId: String?
var flutterResult: FlutterResult!
var hostingController: UIHostingController<FaceLivenessDetectorView>?
override func viewDidLoad() {
super.viewDidLoad();
configureFaceDetection()
}
private func configureFaceDetection() {
if let sessionID = self.sessionId {
let faceView = FaceLivenessDetectorView(
sessionID: sessionID,
region: 'your-region-code",
disableStartView: true,
isPresented: .constant(true),
onCompletion: { result in
DispatchQueue.main.async {
switch result {
case .success:
self.callback("success")
case .failure(let error):
self.callback(error.message)
}
}
})
hostingController = createHostingController(with: faceView)
addHostingControllerAsChild(hostingController!)
configureConstraints(for: hostingController!.view)
}
}
private func callback(_ res: String) {
hostingController?.dismiss(animated: true, completion: nil)
if (res == "success") {
flutterResult("success")
} else {
flutterResult(FlutterError(code: "error", message: res,details: nil))
}
}
private func createHostingController(with rootView: FaceLivenessDetectorView) -> UIHostingController<FaceLivenessDetectorView> {
return UIHostingController(rootView: rootView)
}
private func addHostingControllerAsChild(_ hostingController: UIHostingController<FaceLivenessDetectorView>) {
addChild(hostingController)
view.addSubview(hostingController.view)
}
private func configureConstraints(for view: UIView) {
view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
view.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 10),
view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
])
}
} |
Hi Team, I am integrating aws-ui-swift-liveness in the Flutter app, I installed the dependencies using SPMs but when I am building an app on a real iPhone device it it takes forever time to build. Meanwhile, I have few questions on which I need some clarity as well.
questions:-
building logs:-
building logs.txt
The text was updated successfully, but these errors were encountered: