Firebase logout user all sessions

I am using Firebase authentication in my iOS app. Is there any way in Firebase when user login my app with Firebase then logout that user all other devices(sessions)?

I am using Firebase authentication in my iOS app. Is there any way in Firebase when user login my app with Firebase then logout that user all other devices(sessions)?

Firebase & Swift: Asynchronous calls, Completion Handlers

I have read up a lot on this subject but have still been stumped on this specific problem. I have many Firebase calls that rely on each other. This is a kind of simplified example of my code. I had trouble making it any shorter and still getting the point across:

I have read up a lot on this subject but have still been stumped on this specific problem. I have many Firebase calls that rely on each other. This is a kind of simplified example of my code. I had trouble making it any shorter and still getting the point across:

class ScoreUpdater {

static let ref = Database.database().reference()

var userAranking = Int?
var userBranking = Int?
var rankingAreceived = false
var rankingBreceived = false
var sum = 0

// Pass in the current user and the current meme
static func beginUpdate(memeID: String, userID: String) {

// Iterate through each user who has ranked the meme before
ScoreUpdater.ref.child("memes/\(memeID)/rankings")observeSingleEvent(of: .value) {

    let enumerator = snapshot.children
    while let nextUser = enumerator.nextObject() as? DataSnapshot {

        // Create a currentUpdater instance for the current user paired with each other user
        let currentUpdater = ScoreUpdater()

This is where the asynchronous calls start. Multiple gatherRankingValues functions can run at one time. This function contains a Firebase call which is asynchronous, which is okay for this function. The updateScores however cannot run until gatherRankingValues is finished. That is why I have the completion handler. I think this area is okay based on my debug printing.

            // After gatherRankingValues is finished running,
// then updateScores can run
currentUpdater.gatherRankingValues(userA: userID, userB: nextUser.key as! String) {
currentUpdater, userA, userB in
currentUpdater.updateScores(userA: userA, userB:userB)
}

    }

}

}

func gatherRankingValues(userA: String, userB: String, completion: @escaping (_ currentUpdater: SimilarityScoreUpdater, _ userA: String, _ userB: String) -> Void) {

// Iterate through every meme in the database
ScoreUpdater.ref.child("memes").observeSingleEvent(of: .value) {

    snapshot in
    let enumerator = snapshot.children

    while let nextMeme = enumerator.nextObject() as? DataSnapshot {

Here is where the main problem comes in. The self.getRankingA and self.getRankingB never run. Both of these methods need to run before the calculation method. I try to put in the "while rankingReceived == false" loop to keep the calculation from starting. I use the completion handler to notify within the self.rankingAreceived and self.rankingBreceived when the values have been received from the database. Instead, the calculation never happens and the loop becomes infinite.

If I remove the while loop waiting for the rankings to be received, the calculations will be "carried out" except the end result ends up being nil because the getRankingA and getRankingB methods still do not get called.


self.getRankingA(userA: userA, memeID: nextMeme.key) {
self.rankingAreceived = true
}

        self.getRankingB(userB: userB, memeID: nextMeme.key) {
            self.rankingBreceived = true
        }

        while self.rankingAreceived == false || self.rankingBreceived == false {
            continue
        }

        self.calculation()

    }

So yes, every meme gets looped through before the completion is called, but the rankings don't get called. I can't figure out how to get the loop to wait for the rankings from getRankingA and getRankingB and for the calculation method to run before continuing on to the next meme. I need completion of gatherRankingValues (see below) to be called after the loop has been through all the memes, but each ranking and calculation to complete also before the loop gets called again... How can I within the getRankingA and getRankingB completion handlers tell the meme iterating loop to wait up?

        // After every meme has been looped through for this pair of users, call completion
completion(self, userA, userB)

}

}

function getRankingA(userA: String, memeID: String, completion: @escaping () -> Void) {

ScoreUpdater.ref.child("memes/\(memeID)\rankings\(userA)").observeSingleEvent(of: .value) {
    snapshot in
    self.userAranking = snapshot.value
    completion()

}

}

function getRankingB(userB: String, memeID: String, completion: @escaping () -> Void) {

ScoreUpdater.ref.child("memes/\(memeID)\rankings\(userB)").observeSingleEvent(of: .value) {
    snapshot in
    self.userBranking = snapshot.value
    completion()

}

}

func calculation() {
self.sum = self.userAranking + self.userBranking
self.userAranking = nil
self.userBranking = nil
}

func updateScores() {
ScoreUpdater.ref.child(...)...setValue(self.sum)
}

}


iOS App Development: How Apple's iOS 13 & Swift 5 Will Change App Development Industry

iOS App Development: How Apple's iOS 13 & Swift 5 Will Change App Development Industry

Want to know how Apple's iOS 13 & Swift 5 will change the iOS app development industry? Refer to this blog that contains in-detail information on it.

In June this year, Apple announced the release of iOS 13 during the annual WWDC event along with a bunch of other releases and launches. The new iOS version- iOS 13, was discussed in detail, and the developer community was given reasons to be excited about the new release.

Dark Mode was one of the most awaited updates that the iPhone users were deprived of. Know more about how to enable dark mode for your iOS application.

Sign in with Apple and updates in background tasks kept the developers counting days. As with every new Apple product, whether it is software or hardware, we all look forward to what’s new in it. The release of iOS13 redefines the way mobile app development occurred today. In fact, the powerful combination of Apple’s iOS 13 and Swift 5 will be akin to Batman and Robin when developing mobile apps for the millennials in a demanding market.

If you have been viewing this space, and looking for an answer to the question – how iOS 13 will change the app development space, then here are some clues.

How iOS 13 and Swift 5 Will Change iOS App Development

  1. Augmented Reality Apps Development with ARKit 2
    Augmented Reality is redefining customer experiences. Remember how Pokemon Go became a rage a few years back? Almost everyone had it installed on their phones. They played it day and night, on the streets, competing to catch virtual Pokemon. In fact, it is the same with all the AR-based app solutions. Apple is making progress with its AR technology and has redefined the ARkit to match the needs of the future.

While the ARKit is getting a refined look, Apple has also announced a new AR technology known as Realitykit which will help the creators of AR apps render photorealistic digital material along with incorporating the right type of animation for the same. The best part of the new AR technology is that it works with Swift 5, which means you can develop AR apps for Mac, iPhone, and iPad with ease.

The company had earlier released headsets for AR app solutions, but the headsets were not connected with iPhone or iPad, however, they were linked to the camera app alone. Things have gradually changed in this department. The announcement of this new technology comes at a time when AR has not only picked up but has also been commanding several applications. This new development technique will enhance how mobile apps were creating experiences until now.

  1. Car Play Apps Development
    This combination will give your car the much-needed upgrade. The new version of CarPlay released with iOS 13 will definitely redefine your in-car experience.

The dashboard is the biggest overhaul this feature has received where you can easily view the current music being played by the stereo, the map showing the route to the destination as well as insights into your destination, all in one place. In fact, the dark/light theme is also available for the car plays dashboard. Basically, the new car play ends an era of switching between two screens and helps enjoy the drive.

The maps have also been revamped for the new version of iOS. You also get a better Siri interface with Carplay, which makes your connection with Siri interesting. Carplay also integrates the calendar app thus, allowing you a quick glance into your day’s appointment. The best part of the upgrade is that your car play screen is independent of the phone screen, which means you can read two different things at the same time.

  1. Machine Learning with Core ML
    The advancements made with CoreML are worth knowing, as it will improve the way you integrate machine learning into your iOS-based mobile apps. The new Core ML 3 will expand the horizons of development and will make it easy for you as a developer to introduce machine learning to the apps.

Apart from ease of development, the next big thing introduced in this version of CoreML is the on-device training. The server side training was done using frameworks such as PyTorch and then these applications were converted to Core ML for better predictions. CoreML3 is the new version that supports both inference and on-device training.

  1. Cloud-Based Apps
    You cannot be slow and demand to become successful at the same time. You ought to accelerate not only your app development process but also how your apps work irrespective of the environment. The cloud-based app solutions are the new feature devised by iOS13 that will work in favour of app developers.

From operations to storage flexibility, the cloud proves to be a brilliant way of getting apps to download faster and improve user experience. iOS13’s introduction of cloud-based apps will not only make app development economical by offering flexible pricing but also improve the functionality of the app solutions.

The new cloud-based app solutions offer an exceptional dashboard thus making data accessible, and pave ways for easy monitoring of the app solutions.

  1. watchOS 6
    With the release of iOS13, the watchOS6 will also be released. The new watchOS will come with shortcuts, custom controls, an upgraded Siri and an audio app. The new OS is also set to launch new health features for the fitness apps that you may develop.

The app store has already defined app solutions that can be used with watchOS6. One is the cycle tracking app which helps women track their menstrual cycles while the other app solution is the noise app which measures the level of noise in your environment.

  1. Increased security
    App developers are always concerned about security within the apps. There is always a fear of user accounts getting hacked or their data being stolen. They want to ensure that there is enough security so that the users feel safe when connecting with the apps. The new version of iOS has strengthened app security. The company will be using App Transport Security to incorporate new security standards whenever they are releasing a new app. The app developers will need to ensure that there is a single channel for all interactions with the mobile app.

Getting started with Firebase on iOS - Firecasts

Getting started with Firebase on iOS - Firecasts

Hi there, iOS developers! Interested in adding the Firebase platform to your app? Let's get started with Firebase on iOS in this episode of Firecasts with Peter Friese!

Hi there, iOS developers! Interested in adding the Firebase platform to your app? Well, you've come to the right place! Let's get started with Firebase on iOS in this episode of Firecasts with Peter Friese!