How to create a contact in the "local" addressbook? - iphone

I am wanting to create a contact programmatically into the "local" addressbook (so that it doesn't try to synch, which causes some compatibility issues with Exchange).
If a local addressbook already exists, I can find it using ABAddressBookCopyArrayOfAllSources to get all the sources in the Address Book, then look for the ABRecordRef with a sourceTypeRef of "kABSourceTypeLocal"- if I then pass that recordRef to ABPersonCreateInSource, I can add a record to the local directory.
Does anyone have any suggestions as to how I should best go about creating a record in the "local addressBook", if there ISN'T a local addressbook already?
(also, how could I do this pre-iOS4, as the above calls weren't available then?)
Thanks
Peter

You should take a look at this post:
Obtaining Specific ABSource from ABAddressBook in iOS 4+
that demonstrates how to identify and target specific sources (ABSource) within the ABAddressBook. While this code mentions the function, ABGroupCreateInSource(), there is a similar function, ABPersonCreateInSource() for working with persons.

I found a simple workaround.
Since you can't see/add local contacts when you don't have any pre-existing local contact, the following workaround will be safe to use:
Let's pretend you're using Gmail (Exchange)
Go to your Mail settings for Gmail and disable the Contact sync
When prompted whether you want to keep or remove the Gmail
contacts from your phone, choose to REMOVE them (don't worry, they
won't be removed from Gmail)
Go back to your contacts. You can now create one LOCAL contact
Finally, go back to Settings/Mail/Gmail and re-enable the
Contacts sync
Voila, your Gmail contacts are back into your phone and you now
have 1 local contact that enables you to access the Local contacts
group in addition to the Gmail contacts group.
Hope that helps (I just had the same problem and found this workaround that works great for me).
Ben.

Related

Flutter receive emails

I want to know if there is a package out there that allows people to receive emails / drafts / deleted items from for example gmail. I found something that seemed to attempt it but I think the support has stopped for it and also my gmail automatically blocks any login attempts from it (which I can evade but if I want to eventually release it then of course this is not the correct option)
The "Potentially non supported" package: imap_client
I was wondering if someone has found a better / new package that doesn't have that issue or if someone knows how to write one.
Thanks in advance
Didn't really understand if you want to send it using SMTP or if you want to open the mail app.
For sending programmatically: https://pub.dev/packages/mailer
To open the gmail app: https://pub.dev/packages/flutter_email_sender

Edit iOS notes via IMAP

I'd like to create and edit notes created by the iOS Note app programmatically from the server-side.
I can see the notes created by the iOS device in my IMAP folder but any changes I make won't show up on the iOS device.
Does such API exist?
I just wondered myself and tried editing the note with mutt. As emails (via imap anyway) are not meant to be edited (as correctly stated by #CodaFi) mutt copies the note into the editor, saves it as a new "email" and delete the old one. The edited note gets synced to Notes.app just fine.
Beware: The title/subject of the note/mail is derived from the first line of the body.
PS (I don't think it affects the validity of the above): My setup is private IMAP server & mbsync with local Maildir & mutt.
Well, I use the HeaderTools plugin with Thunderbird to accomplish this, so it's certainly possible. The notes app picks up the changes right away. ( I's not a very satisfying solution as HeaderTools only allows editing as html source in its own viewer/editor )
I guess you could fire up wireshark to investigate precisely what goes on.
The drafts theory sounds plausible. If I needed to dig into this, I think I would just try it out with python directly, instead of googling around for hours.

iPhone Dev - Creating a one time UIAlertView like in Temple Run

You know how Temple Run sometimes has alerts when you open the App that appear even though you don't update the App? I understand how you would implement this if you were to submit an update to your App, but how does Imangi implement new alerts without releasing new versions of the App? (I'm assuming they upload it from some server, but I'm an amateur at all of that stuff so could someone sorta vaguely explain how I might go about doing that? Will I need to learn Internet programming languages :O?)
Thanks.
I agree with Jonathan. I would set a plist with a reference number on your server. and it would look something like this. I'm using concept, not code. It would be as simple as hosting it on your server. Or it could be as complicated as your creating a user interface on your website that allows you to just plug in the information and it would create the plist for you.
-(void)checkanddisplaynotificationbasedonupdatedplistontheserver{
int currentnotificationnumber = userprefs preference for item "notification"
get and parse notification.plist from your server
notificationnumber = object at index 0
if notificationnumber > currentnotificationnumber{
display your notification with parsed plist
}
}
You could host a plist online, with an array of alerts stored as dictionaries, with attributes like 'title', 'body' etc. The app would then parse this and to create an alert. You could then set up a method which searches for updates to this file every time the app opens and has connectivity.
This is not the only way - there are probably hundreds of other files types/ automated systems to use, however this is a simple way, and roughly how all of them work, and I have implemented something like this in some of my apps. Hope this helps, if you wan't any help coding it, I will be happy to help!
Jonathan

Is there a module for Drupal 7 to reset passwords for all users

Is there a module for Drupal 7 to reset passwords for all users. Same time it must send them email with new password or even better- link to create new one by them self.
There are some modules out there what I found but not doing what I need. For example http://drupal.org/project/account_reminder
I am starting to think that I have to write one by myself. Maybe combaining answer https://drupal.stackexchange.com/questions/27768/how-can-i-programmatically-reset-a-users-password and module http://drupal.org/project/account_reminder
Any other thoughts?
I'll add an answer because this question popped up in a google search for mass password reset
The module mass password change module https://www.drupal.org/project/mass_password_change does what you want.
This module adds a views bulk operation action to reset the passwords of selected users that you can use in a custom view or admin view
You might take a look at : http://drupal.org/project/force_password_change
I haven't tested yet but the description seems to define your needs.
wish helps,
Cheers,

Discovering the user's first and last names?

I am trying to programmatically discover the first and last names of the iPhone user. Is this possible at all? Calling this ...
getpwuid( getuid() )->pw_gecos == "Mobile User"
..alas. Iterating over the address book finds all address book records, but doesn't distinguish between the device owner and anyone else (that I can tell).
Given that the Mac desktop address book decorates the owners icon with a 'me' overlay in the bottom-left, I'm hoping that sort of information is available in the iPhone version.
Martin.
As noted in the other thread, there is NSFullUserName() - this call does come up in the iPhone documentation so it should work on the device. Simply parse out the first and last name from that.
See similar question - there is no public API for that.