How is the user created in the default Users table of iCloud Dashboard? - swift

I'm using the cloudkit, and I found in Apple's management platform, iCloud Dashboard, that PublicDatabse defaults to the "Users" table, and there was a record that should be my developer record.
I want to know how it was created because I now need to use the records under "Users".
If a new user opens my App, does it automatically create a "Users" record? Or do I need to manually create it myself?

Related

How do I trigger a blocking function when a new user registers to check that their email address is in a collection?

I have a flutter app using firebase and google cloud. The organization providing the app to their users uploads a list of users that are able to register and create an account. When a user goes to register I want two things to happen:
They are given an error message if their email address and ID number do not match an existing document with email and ID field values
Existing fields, like their department and deck number that are in the collection uploaded by the organization are copied to their new user profile
I would write a cloud v2 function. The documentation has some great examples of how to block registration. What you would want to do is in the beforeUserCreated method, look up the field in firestore to validate that their email. You can get their email through the AuthBlockingEventType additionalUserInfo field which should provide the username (email in this case) to compare against the firestore database.
Deploying an AuthBlocking function is the same deployment as any other function.
Once deployed, you will need to remember to register your blocking function for it to take effect.
As far as updating their user profile information, you could just use another cloud function to listen for a database change once the user is registered and then copy that data over.

Where should I keep data to continuously use in server?

Currently, I'm trying to build a dating app(server part).
I'm going to store each user's profile data like videos, photos, profile messages to AWS S3.
And I have user info including location(longitude, latitude) in my database server.
If you've ever used this kind of app, you might easily understand how it works.
First, whenever a user opens this app, the user gets to see the profile of other users one at a time based on the current location.
Second, the user gives like or dislike to the current profile and gets to the next profile.
So, in order to implement the first step, I'm going to search other users in a certain distance from the user's current location in the database, but here I'm only going to get unique user ID values from database. This only happens once when a user opens the app.
Now that I have other users' id values like [id1, id2, id3, id4...] I can load each user's profile data from AWS S3 with each unique id value one by one whenever the user needs to see the next profile.
Here my question comes. To build the recommendation logic like that, where should I keep the id values??
Thanks in advance.
Use a in memory cache like Redis/memcache (both provided by AWS). Also your cahce should get updated as and when data in AWS S3 profile updates because only then you will have latest data.

Mutli-User Firebase Database

I'm trying to create a sign up screen in Xcode that allows a user to pick a "account type" designer, singer etc. that then groups those individuals together and creates their account, grouping them by their account type.
I am able to create accounts and store them within my Firebase database and I have the drop box with all the account types but I don't understand or know how to create these account types and attach them as identifiers of each user upon sign up.

Use CloudKit to return users records and deny accounts

instead of code, have more of a best practice/functionality question regarding CloudKit. Can't seem to find answers, or maybe just don't understand.
Questions:
When I save the record, cloud kit creates a unique record id, i was thinking of getting that id and storing in core data to allow specific query's on that at a later time vs entire database searches. However, once I save a record, how do i get the record id that was created? Is this possible?
What if I allow a user to report another user for some reason and thereby want to block that user from posting to the cloud until a review can be done. Is there a user access database in the cloud? if not, thoughts on how to?
Thanks all.
By default when you create a CKRecord it will generate a guid as it's ID. You can also specify your own id the moment you create the CKRecord. The it does not need to be a guid. As long as it's unique. Your save action will have a callback where you will get the ID.
Every user has it's own unique id which you can easily get. You could create a table with your blocking information. You only have to query for that yourself to implement the blocking mechanism.

Pressist CFUUIDRef After App Deleted

Recently apple has reject apps that uses the unique device identifier (UDID), in my app i am creating once aCFUUIDRef for each device on the first time, which works great.
in my app i am giving to a new user 10 clicks on a button (some service), when i am creating a device id for the first time it sends to the server and this id is now have credit of 10 clicks.
the problem is when the user delete my app it generate a new identifier.
how can i write some file to the iphone withe an identifier lets say for example "MyCustomDeviceID"
and when a user download the app i am checkin if this file is existing, if it does i am getting the saved parameter and if it doesn't i am creating the identifier and then creating the document.
i got to have some way to leave a mark on the iphone.
ideas will be appreciated!
Assuming that you can convert a CFUUIDRef into an NSString, you can store it in the keychain. Items stored in the keychain persist across app deletes. Check out PDKeychainBindingsController for reference.
On iOS you have no "shared space" where save data and maintain it after the application deletion. You have to do it in other ways:
you can enable iCloud for your app and save your id using NSUbiquitousKeyValueStore.
You can save your identifier in NSUserDefaults, so if the app is deleted and then reinstalled it will be available in the backup. (obviously the user have to restore from backup)
Or you can associate the identifier to a nominal account. (you have to create a system where the user can do a registration and login with this nominal account)