Create page after login xcode - ios

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()

Related

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.

SFAuthenticationViewController issue with Google on iOS 11

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

Twitterkit present a new viewcontroller instead present on a target viewController

Im using TwiterKit 3.0 framwork. And im using Deeplink to share a tweet for my application. But the problem is its presenting a new viewController and shows the twitter dialogue box. But my requirement is need to share like in Photos app sharing screen.
if let deepLinkurl = branchObject.getShortUrl(with: shareLinkProperties) {
let composer = TWTRComposer()
composer.setURL(URL(string: deepLinkURL))
composer.show(from: self) { result in
if (result == TWTRComposerResult.cancelled) {
print("Tweet composition cancelled")
}
}
If i run above code I get like this
But I need something like this.
You can use Branch's showShareSheet() method for sharing Branch links to other apps.
Here is how the link is shared when using the shareSheet and selecting Twitter from the list of the Apps.
You can check out the documentation here

How to implement Login module as part of my iOS framework

I am building an iOS framework and it should provide some common module like Register, Forgot Password, Login and Profile etc. So, any application that imports my framework should able to use these screens as it is. The challenge that I am facing is navigating from one screen to another screen in my iOS framework code. When navigating from once screen Login(screen1) to another screen Forgot Password(screen2), the handler(callback) methods are being invoked in screen1 view controller instead of screen2 view controller. We tried using xib and storyboard, however I did not find a solution for this.
Can somebody please point out any example code which does the similar stuff ?
Am I missing some thing over here in understanding iOS concepts, I am building an iOS framework which includes some UI flows, Is it possible?
I would suggest a delegate pattern, because callbacks are more one-shot, while delegates serve better the purpose to continually assist the lifetime of an object. Anyway I've created an example to cope with your requirements, git it here (Framework + test app included)
It involves a LoginController, which is the main entry point and orchestra for the framework.
When you initialise it, you pass a callback which will be used to send events, including "forgot password" and "user wants to exit", those are defined in an enum.
public enum LoginFrameworkStatus {
case Login
case ForgotPassword
case Help
case Disaster
case Exited
case UserWantsExit
}
Class offer an entry point to start the process:
public func enterLoginWorkflow(on controller: UIViewController, callback: LoginFrameworkCallback) {
let myBundle = Bundle(for: LoginController.self)
if let navi = UIStoryboard(name: "LoginWorkflow", bundle: myBundle).instantiateInitialViewController() as? MySpecialNavigationController {
presentingController = controller
navi.loginController = self
self.callback = callback
controller.present(navi, animated: true, completion: {
//presented!
callback?( .Login, navi, self) //If reference to LoginController is lost, tell the callback there's a problem.. shouldn't happend because we have a strong reference on the navigation controller.
})
}
}
.. and an exit point:
public func leaveLoginWorkflow() {
presentingController?.dismiss(animated: true, completion: {
self.callback?(.Exited, nil,self)
})
}
So the main interface for your framework would be:
LoginController().enterLoginWorkflow(on: self) { (status, controller, loginController) in
print("\(status) in \(controller?.description ?? "No Controller")")
switch status {
case .UserWantsExit:
loginController?.leaveLoginWorkflow()
case .ForgotPassword:
loginController?.leaveLoginWorkflow()
default:
()
}
}
In the test app I included a minimum workflow for you to test.
Let me know if this is what you needed, or if you want to investigate the delegation pattern, which I think would be way more suitable for this.
Try 1) IcaliaLabs/LoginKit (https://github.com/IcaliaLabs/LoginKit). LoginKit is a quick and easy way to add a Login/Signup UX to your iOS app.
2) TigerWolf/LoginKit https://github.com/TigerWolf/LoginKit
We can create a framework just like Parse.com does. It's well known and great app that used by thousands of developers.
Refer https://github.com/parse-community/ParseUI-iOS

Firebase is referencing an old project and not the current one

In my new project, I am making sure that users do not have to go to the login screen every time they open the app by using the following code:
// this means that there is a user logged in... take them to the main view.
if let x = FIRAuth.auth()?.currentUser?.uid {
print("The current user is: \(x)")
// first param is storyboard name
self.setTheRootViewController("Main", identifier: "GroupChatsView")
}
// take them to the login view controller
else {
self.setTheRootViewController("Main", identifier: "LoginView")
}
I have not created any users yet, so I would expect this code to take me to the login view every time. But, For some odd reason, when I print out the current user's unique id, it is my own unique id from a previous project. I am not sure what to do at this point. Also, everything in my GoogleService-Info.plist matches up with my new project.
When I logout of my other app in the iOS simulator, the code functions as expected.
Are there any easy workarounds for this? Thanks.
In your simulator clean and reset settings ! It does the trick.

Resources