Hi guys ...
I had a similar issue ...
I was developing an iOS app and inside the app I accidentally removed some of my contacts - long story 😊
Anyway - I noticed that a day later ... and in the meantime both my iPhones already made another backup to the iCloud.
So I would 'erase' everything ... hit 'restore from iCloud backup' ... select a backup from 3 days ago.
The phone would restart ... restore ... contacts here ... and then it would automatically re-sync to iCloud (since I had iCloud turned on 3 days ago) ... and I would watch my contacts disappear ... not fun 😢
I slightly modified what getreed did, since my Mac was on the other side of town and it was really late 🙂
The difference is you don't need iTunes and a 3rd party app to perform this.
So here's what you can do (read before executing):
- go to 'Settings -> Reset -> Erase All Content and Settings'
- when it restarts ... select 'Restore from iCloud backup'
- choose a backup from a date before everything went wrong
- (now - like getreed said ... get ready ... you have to do this fast)
- when it restarts again skip everything to get as quickly as you can to the home screen (WiFi network - skip, iCloud login skip, Fingerprint thingy skip, Passcode skip)
- swipe up - turn ON 'Airplane mode'
- (your contact should be here if you did it quickly enough)
- back to 'Settings -> iCloud'
- turn OFF 'Contacts' from the sync options
- when the ActionSheet popup appears - select 'Keep'
- turn OFF 'Airplane mode' - your iPhone will continue to restore, but your contacts should still be here (since they're now excluded from the sync)
- wait a minute or two for your iPhone to get back online and resume the restoring process
- back to 'Settings -> iCloud'
- then turn 'Contacts' back ON
- this time select - 'Merge'
What will happen is it will merge what you've kept on your iPhone (full contacts) with what you have on your current iCloud variant (partial contacts).
After the merge it will sync that to iCloud as the latest version ... the restore will complete ... and your Contacts should be safe.
I would recommend you perform a backup to iTunes at that point ... since restoring an iTunes backup doesn't require a black magic ritual to perform 🙂
Good luck!
A.
p.s. Semi-offtopic:
For all iOS developers out there (I noticed quite a few posts about this on stackoverflow ... so maybe Google will lead you here 😉)
Btw. when an app (any iOS app) asks to access your contacts and you say 'Yes' - it has the permission to delete everything ...
I learned that the hard way - my phone - my app - my contacts ... and one line of code is enough...
so be careful when using ABAddressBook, becuase:
Creates a new address book object with data from the Address Book database.
It does NOT create a NEW address book - you're still working with THE address book.
And even though it says...
Changes made to the returned address book are reflected in the Address Book database only after saving the address book with
ABAddressBookSave
.
That's NOT true - any call to 'ABAddressBookRemoveRecord' will delete the contact from your address book regardless if you made changes with ABAddressBookSave or "discarded" the changes using ABAddressBookRevert. Once removed - it's gone ...
What you want to do is ALWAYS just READ from the AddressBook and build your own array of people to perform filtering, grouping and such operations.
Happy coding!