SFAuthenticationViewController issue with Google on iOS 11 - ios

I implemented authentication using Google Sign In and everything works correctly. However, if the user taps Cancel on the Google-generated dialog box that asks the user "Foo Wants to Use "google.com" to Sign In", the app crashes with a 'Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior: SFAuthenticationViewController' error.
I thought maybe I did not implement an optional function in the GIDSignInUIDelegate but I have them implemented and there is nothing in the Google documentation that talks about this possibility (https://firebase.google.com/docs/auth/ios/google-signin).
Does anyone know what I am missing to handle a Cancel press?

In my case I was doing popToRoot back navigation, so I have been set delegate and presentingViewController on viewDidLoad() but actually when I come back there is no reference for GIDSignIn.sharedInstance().delegate and GIDSignIn.sharedInstance().presentingViewController.
Simply I wrote code on google login button action:
#IBAction func buttonHandlerGoogle(_ sender: Any) {
//===These lines added for the reference=========
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().presentingViewController = self
//===============================================
GIDSignIn.sharedInstance().signIn()
}

Related

Create page after login xcode

I'm an XCode noob and I've looked all over for the answer. This is my first time building anything in XCode and I've created a login window using Firebase in ViewController.swift. Once the user is logged in, I want them to go to another screen that is using MapKit etc. How do I automatically link the login window success to the second page?
I've created a new cocoa touch class file as MapViewController.swift - do I just call the map function at the end of the login function or is there a more simple way to do it with the storyboard?
Sorry for the stupid question
after you check that the user enters the right credentials set function to call the new view controller
func transition() {
let mapViewController:MapViewController = MapViewController()
self.presentViewController(mapViewController, animated: true, completion: nil)
}
then call it
transition()

provideCredentialWithoutUserInteraction method not getting called for autofill extension

I am developing password manager App with autofill Credential Provider extension.
method provideCredentialWithoutUserInteraction of ASCredentialProviderViewController is not getting called or not able to trace via breakpoint.
Code I have tried so far:
override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) {
print(credentialIdentity.serviceIdentifier.identifier)
let credToProvide = ASPasswordCredential(user: "udayyy", password: "paasssss")
self.extensionContext.completeRequest(withSelectedCredential: credToProvide, completionHandler: nil)
}
also not able to print any logs.
Can any one help me with how to debug this method?
What exactly I want show my custom password on top of the keyboard.(shown in below left image)

ReplayKit Broadcast upload extension - Service not found

I'm working on an IOS swift application that will allow the user to record the entire screen, any app and even the home screen.
In order to do that, I added a Broadcast Upload Extension to my app.
First I used the RPSystemBroadcastPickerView class in order to add a record button to my view that allow the user to open the record popup and select to which app he wants to broadcast the screen flow. And it's working fine :
But I would like to avoid this step and directly open the popup when the app launch.
So I wrote the following code to do that :
RPBroadcastActivityViewController.load(withPreferredExtension: "ch.jroueche.RecordApp.TestScreen", handler: {broadcastAVC,error in
guard error == nil else {
print("Cannot load Broadcast Activity View Controller.")
return
}
if let broadcastAVC = broadcastAVC {
broadcastAVC.delegate = self
self.present(broadcastAVC, animated: true, completion: {
// broadcastactivityviewcontroller will perform the callback when the broadcast starts (or fails)
print("I've START")
})
}
})
Unlikeenter code here the RPSystemBroadcastPickerView solution, I'm getting the following error :
The preferred broadcast service could not be found.
My issue is similar to the following post :
App not showing up as a broadcast service in RPBroadcastActivityViewController
I also added the extension and the preferred extension identifier is correct.
Why would it be possible using the RPSystemBroadcastPickerView and not programmatically using RPBroadcastActivityViewControllerclass. That does not make sense for me.
Does someone have an idea of what could be the issue and how could I fix it ? Or a workaround in order to do this screen record.
Thanks in advance
It appears that RPBroadcastActivityViewController shows ONLY Broadcast Setup UI Extension, while RPSystemBroadcastPickerView shows ONLY Broadcast Upload Extension. But I have no idea why, as both of them are stated to show list of available providers/services.
It would be very helpful if someone could bring more details on the topic.

UIImagePicker Controller doesn't request permission even with plist entry

I am having trouble with UIImagePickerController. I want to be able to open the photo library and select an image, when I do I get the following error
[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}`
I assumed this was probably a permissions error since I mistakenly hadn't added a row in my plist for photo access so I added the entry for photo library access:
Privacy - Photo library Usage Description with the type string and value set to photo use
and still I get no prompt for permission to access photos when I try and access them.
To minimise anything else causing problems I have made a new project it simply has a single view controller and the above entry in the plist, below shows the only code in this class
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate
{
var mImagePicker:UIImagePickerController?
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
#IBAction func tapped(_ sender: Any)
{
// Pick an image from the photo library
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary)
{
mImagePicker = UIImagePickerController()
mImagePicker!.delegate = self
mImagePicker!.sourceType = .photoLibrary;
mImagePicker!.allowsEditing = false
self.present(mImagePicker!, animated: true, completion: nil)
}
}
}
when I tap the button I see no prompt for permission, the photo library simply appears and when I select a photo I get the error shown above? is there something I'm missing here?
Im running iOS 12 on an iPhone X and Xcode 10.0 on the latest version of the Mojave beta
You don't actually need permission if you're just accessing photos using UIImagePickerController from iOS 11. Permission is required when you use AVFoundation or Photos framework.
In my experience, iOS logs those errors that we can ignore sometimes, and I think you can ignore the error messages this time.

Why would this swift code still be performing the segue?

I have a conditional segue set up that will perform the segue set up the following way:
override func viewDidAppear(animated: Bool) {
if PFUser.currentUser() != nil{ //if the user is logged in previously
self.performSegueWithIdentifier("AlreadySignedIn", sender: self)
print(PFUser.currentUser()?.username)
}
Even deleting all users from the database (Parse), the segue is still performed. I don't think the problem is with the syntax of this particular code, but does anyone have any ideas what might be causing this?
PFUser.currentUser() is not aware about the users that you have in your DB.
when you log in to Parse via parse ios SDK. the parse IOS SDK save the currentUser instance on your disk and when you specify PFUser.currentUser() the parse IOS SDK check if the user was logged in before (by checking if it is stored on the disk). if you want that the PFUser.currentUser() will return nil you must call PFUser.logout() function. this function will clear the current logged in user.

Resources