XCode: how to get the email of the user programmatically? - iphone

I would like to avoid to ask my user to fill in a field with his email (long and discouraging). Is there a way to get the email of the user in order to avoid that he has to write it ?
Thanks !!!

Ask first time, make user select remember me option through UISwitch, save it inside a plist (ENCRYPT and then SAVE IT). Next time read the plist. If user like to write every time then good for them, else they can user your given option to save it and then later you can complete the field automatically!

If you mean the apple ID email, then you cannot access it, you will have to ask the email explicitly

Related

Power apps set button visible if user email is the same as requestors email

I have a form request and i want to let someone edit only his own request except from me and my team that we can always edit. So I need to set edit button visible only for my team and the original creator of the form. I used the user.email to get the email of the user who uses the app but I cant use equality netween this variable and the data card value as its incompatible user type. Text with table. How can i get the email in the data card and compare it to the users email?
actually it's quite easy, your requestorEmail should be coming from some datasource like sharepoint record or datavererse or so on.
You can get current record and then it's property requestorEmail convert it to Text using Text function.
you could also try ThisItem.requestorEmail and with text function you can do so.
Ms Docs should help
In addition if you could show/add code for your requestorEmail data card, I can try to provide exact function to extract email. but above info should lead you in correct direciton
I used on change action of the datacard and used set global variable varUserEmail to thisitem.requestoremail . Then i set the button visible if the user email = varUserEmail.Email . So in this way everytime the email changes to the email that is supposed to edit the request the buttons are visible for editing or deleting the report.

how can i upload course and user with its id on moodle

I want to upload course using upload courses menu.
and i want to import the id with the other fields.
I tried "id","shortname","fullname","category" as a filed on the csv.But it uses incremented id instead.
Oh and i want the same thing for user too.
That cannot be done - all ids in Moodle are automatically generated, in order to make sure they always uniquely identify the item (course, user, etc).
Instead of trying to identify the course by id, you should look at identifying it by shortname or idnumber.

cloudkit: how to access main user's attributes?

I am trying to make an app in which every user would have a personal avatar, a nickname and so on.
I don't know how to access the user's account on cloudkit.
My solution would be to retrieve user's AppleID, query Cloudkit and modify the user's attribute... But I guess there should be a better way to do it. Isn't their something like NSUserDefault but for cloudkit?
You first have to find out what the current loged in userId is. You can do that by executing the fetchUserRecordIDWithCompletionHandler method on the container. Then you can get more (currently only first and last name) information by executing the discoverUserInfoWithUserRecordID on that container.
You could extend the Users table with extra custom fields, but I would not advice doing that. The Users table is a special system table with some limitations. It would be better to create a separate recordType with the user settings. Just add a CKReference to the users table for easy access.
You also have to be aware that a user could log out and log in with a different iCloud account during the operation of your app. You could capture this by executing the code below right after your application start. Of course you have to implement your own logic where you see the NSLog
var ubiquityIdentityDidChangeNotificationToken = NSNotificationCenter.defaultCenter().addObserverForName(NSUbiquityIdentityDidChangeNotification, object: nil, queue: nil) { _ in
NSLog("The user’s iCloud login changed: should refresh all user data.")
}

a coupon (unique code) for a like clicked. what is the best way

The unique code is given to whoever clicked like (only the first time he clicks)
in order to make sure that he is not going to have a unique code again. I have to have his fb id in my database, but I read that it is impossible to know the fb id of someone who clicks like. Is there a solution?
If the like button will be on my fun page, is it possible then?
I have already all the process of generating the unique code, and checking in my db if the code was used or know, I only have to keep in my db also the fb id to make sure he will not get more then once.
Create fangate (differentiate likers non-likers).
Is is_liker get user id with basic permissions.
On return after accepting the permission request check if user already got code.
If user never got code give him. Else display error message.

Code to Prevent Form repetition based on Name & DOB

I'm a joomla Developer, want a PHP code to avoid user from filling the form more than once. i.e., as he/she enters the name & DOB, if there is already a record in DB of same name & DOB an automatic message should be generated preventing the user from filling the form twice
If you mean that the user is not logged in, then starts entering the form data, then the only way to accomplish what you want is to use AJAX to validate the name and DOB as soon as they are entered. There is a registration extension that has AJAX validation that you could probably modify to suit your needs.
http://extensions.joomla.org/extensions/access-a-security/authentication/7361