ios app based on Firebase database - to incorporate changes locally - ios

In an iOS app, developed using Firebase Database, can a user make changes to database on his/her device that is reflected only locally on his/her device?
My app is a contacts app and I want any user be able to edit or favourite a contact which should be only reflected on his/her device and not to every user using the app.

I'd recommend reading up on structuring data in Firebase: https://firebase.google.com/docs/database/ios/structure-data
(When you're done, read all the docs or perhaps follow some video tutorials on Firebase.)
This will help you establish a better understanding of how Firebase works, helping you with more than just the problem at hand.

Related

Tracking active users on Firebase

Apologies if this question has already been asked but I have no been able to find it. I'm trying to figure out if there is a way to track how often a user opens my app if they're already logged in. Firebase only shows the last time they're signing in, but not if they're already signed in so I don't know when they've actually been opening my app last.
There is no presence tracking built into Cloud Firestore. It just doesn't match well to the protocol that Firestore uses to communicate between client and server.
The simplest way to get this working is to use the Realtime Database, and potentially synchronize the information to Cloud Firestore from there. For a walkthrough of this (quite involved) scenario have a look at the Firestore documentation on building a presence system.

iOS app trouble storing user's documents/photos anywhere other than the phone

I'm trying to find a way of letting a user store their photos/documents online for my app. They can upload these to the app after registering an email and they remain on the phone even when the user logs out and then in again. However if the user deletes the app, downloads it again (the developers are using TestFlight at the moment), and logs in, any photo or document that the user saved before deleting has vanished.
I've been told that the data hasn't been stored on the Kinvey SDK service that we have been using as it takes a while to upload the data and then was told the app would be better suited on Kinvey REST API as the SDK version doesn't support background mode which supposedly would help store the data quicker (but this still wouldn't be 100% sure the photos/documents would be stored)
I'm not a developer/coder so I'm afraid I don't know much technically but my app needs to be able to have access across devices for the user's photos and documents, if these are 'lost' it would be catastrophic.
Please could someone help me if there a way of doing this?
Thank you.
Well If you want to save pictures or data that do not get deleted here are few options.
Save them iPhone,iPad gallery if not the use REST API
"Kinvey" can be used for that.
The alternative of "Kinvey", Kindly look into this.
https://www.raywenderlich.com/126098/top-5-parse-alternatives.
and may be you can try this. It provides chat feature too.
http://quickblox.com/

Using Firebase with multiple users in an iOS app

A number of iOS apps I develop are used in scenarios where the Organisation has a number of Drivers and the iPhone is shared between them. Each Driver has his own app credentials, logs in to the app, and is presented with his own set of data. The Firebase data is persisted as he is offline most of the day and I use keepSynced(true) to ensure data is up-to-date.
The problem I'm having is that once a user logs out with the Firebase method FIRAuth.auth()!.signOut() then when a different user logs in, he sees the previous users' data. I'm guessing that because the data is persisted it is not cleared from the cache. However, I am retrieving the data by the user id so this doesn't quite explain it.
What is the best pattern to permit multiple users to use the same iOS app with Firebase ?
Try creating multiple instances of FIRApp, each with a different name, using the +configureWithName:options: method. Then use the different apps in FIRAuth +authWithApp and elsewhere as needed.
I haven't actually done this and am too new to Firebase to say it's the best pattern, but it seems like it should work.
One thing to note from the docs is that, "On Android and iOS, Analytics are only logged for the default app." One solution might to keep the __FIRAPP_DEFAULT app, and then make a named app for each user type.

Using Multipeer Connectivity Framework and saving the nearby devices founded

I am new to Swift and is currently developing an Multipeer Connectivity app for a course project. The app also has an online log-in feature that stores each user information in Firebase(the backend support).
Once the app gets wifi connection, I want to have a 'friends list' feature in my app and add other app users to this list from the nearby devices found. So far, the only way I could think of is to associate the peerID with an existing app user from Firebase. However, according to the documentation, peerID seems to be associated with the device itself so if two different users used the same device to sign in, this approach can't really work. Is there a better way to achieve my goal?
In my opinion, it depends on what do you want to go with your application as well as how you develop it regarding your business. One of possibility is that one user as a point of time is just registered one device. So you can provide a simple login screen that users will enter their name then map it with device id and save to Firebase. The username is considered as user id as well. So if they try to sign in from another device, you will check whether or not it existed in the system. if existed, ask them that wish to register this device or not, then update your map (user id and device id) from Firebase.
From your friend list, it is still a list of the username of your friends,in which you can add any nearby devices found.

Programmatically How to wipe out iPhone or iPad data in i phone apps

I am developing an application for security purpose which has 1 requirement as "Wipe out iPhone or i pad data completely if device is stolen".
While doing search for this functionality, I came across one application "Find My iPhone" here which supports this feature of "remotely wipe out all data".
(http://www.howtogeek.com/77158/how-to-remotely-lock-or-wipe-your-ios-5-device/)
But i want to this functionality through programmatically in my app.Can someone give me a solution for this problem?
And is it possible to do this functionality through programmatically?
You cannot completely wipe a standard iPhone's data from an app. The app runs in a sandbox environment so you cannot access data from other apps or iOS itself meaning that you cannot wipe it. That being said, you could wipe photos and contacts programmatically as long as the user grants you access to contacts and photos.
There is NO WAY that Apple would let programmers wipe data remotely for the entire device.
Instead of doing that, maybe you should have functionality in your app where if server returns a particular flag, you would delete all the data stored locally on your app, by you (like login details for your app, personal data stored in Documents). I suggest that, because I've done it before.

Resources