def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorFirebaseAuth', :path => '../../node_modules/capacitor-firebase-auth'
end
target 'App' do
capacitor_pods
pod 'GoogleSignIn', '5.0.2'
pod 'Firebase/Core'
pod 'Firebase/Auth'
Add your Pods here
end
`
AppDelegate File updated -> due to compile issue
`import UIKit
import Capacitor
import FBSDKCoreKit
import GoogleSignIn
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
return GIDSignIn.sharedInstance().handle(url)
}
}
extension AppDelegate: GIDSignInDelegate {
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if let error = error, let gidSignInErrorCode = GIDSignInErrorCode(rawValue: (error as NSError).code) {
switch gidSignInErrorCode {
case .hasNoAuthInKeychain:
print("Indicates there are no valid auth tokens in the keychain. This error code will be returned by restorePreviousSignIn if the user has not signed in before or if they have since signed out.")
case .canceled:
print("Indicates the user canceled the sign in request.")
case .keychain:
print("Indicates a problem reading or writing to the application keychain.")
case .EMM:
print("Indicates an Enterprise Mobility Management related error has occurred.")
case .unknown:
print("ndicates an unknown error has occurred.")
default:
print("Unexpected error")
}
return
}
}
func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) {
print("Disconnect this app from Google Account")
}
[Log] TypeError: w.Capacitor.nativePromise is not a function. (In 'w.Capacitor.nativePromise('CapacitorFirebaseAuth', 'signIn', _options)', 'w.Capacitor.nativePromise' is undefined) (main.js, line 81851) user-script:2:10:35 (anonymous function) — facades.js:43 (anonymous function) — Observable.js:43 (anonymous function) — Observable.js:29 (anonymous function) — loginService.ts:58 Promise (anonymous function) — loginService.ts:57 tryCatch — runtime.js:45 invoke — runtime.js:274 (anonymous function) — loginService.ts:7 Promise (anonymous function) — loginService.ts:3 runCallEffect — redux-saga-core.esm.js:524 runEffect — redux-saga-core.esm.js:1204 digestEffect — redux-saga-core.esm.js:1271 next — redux-saga-core.esm.js:1161 currCb — redux-saga-core.esm.js:1251 (anonymous function) — redux-saga-core.esm.js:481 exec — redux-saga-core.esm.js:31 flush — redux-saga-core.esm.js:87 asap — redux-saga-core.esm.js:46 (anonymous function) — redux-saga-core.esm.js:375 (anonymous function) — redux-saga-core.esm.js:1412 onClick — Login.tsx:37:142 callCallback — react-dom.development.js:188 dispatchEvent invokeGuardedCallbackDev — react-dom.development.js:237 invokeGuardedCallback — react-dom.development.js:292 invokeGuardedCallbackAndCatchFirstError — react-dom.development.js:306 executeDispatch — react-dom.development.js:389 executeDispatchesInOrder — react-dom.development.js:414 executeDispatchesAndRelease — react-dom.development.js:3278 forEachAccumulated — react-dom.development.js:3259 runEventsInBatch — react-dom.development.js:3304 runExtractedPluginEventsInBatch — react-dom.development.js:3514 handleTopLevel — react-dom.development.js:3558 batchedEventUpdates$1 — react-dom.development.js:21871 batchedEventUpdates — react-dom.development.js:795 dispatchEventForLegacyPluginEventSystem — react-dom.development.js:3568 attemptToDispatchEvent — react-dom.development.js:4267 dispatchEvent — react-dom.development.js:4189 dispatchEvent unstable_runWithPriority — scheduler.development.js:653 discreteUpdates$1 — react-dom.development.js:21887 discreteUpdates — react-dom.development.js:806 dispatchDiscreteEvent — react-dom.development.js:4168 dispatchDiscreteEvent
PodFile `platform :ios, '12.0' use_frameworks!
workaround to avoid Xcode caching of Pods that requires
Product -> Clean Build Folder after new Cordova plugins installed
Requires CocoaPods 1.6 or newer
install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorFirebaseAuth', :path => '../../node_modules/capacitor-firebase-auth' end
target 'App' do capacitor_pods pod 'GoogleSignIn', '5.0.2' pod 'Firebase/Core' pod 'Firebase/Auth'
Add your Pods here
end `
AppDelegate File updated -> due to compile issue `import UIKit import Capacitor import FBSDKCoreKit import GoogleSignIn import Firebase
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
}
extension AppDelegate: GIDSignInDelegate { func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { if let error = error, let gidSignInErrorCode = GIDSignInErrorCode(rawValue: (error as NSError).code) { switch gidSignInErrorCode { case .hasNoAuthInKeychain: print("Indicates there are no valid auth tokens in the keychain. This error code will be returned by
restorePreviousSignIn
if the user has not signed in before or if they have since signed out.") case .canceled: print("Indicates the user canceled the sign in request.") case .keychain: print("Indicates a problem reading or writing to the application keychain.") case .EMM: print("Indicates an Enterprise Mobility Management related error has occurred.") case .unknown: print("ndicates an unknown error has occurred.") default: print("Unexpected error") } return }}
func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) { print("Disconnect this app from Google Account") }
} `