objective c - Addressbook Modified Date in Xcode -
i creating application in used update contacts sqlite database on rewrite actions. used fetch contacts addressbook of iphone on user's permission everytime user logged in , insert database on main thread.
i don't want insert iphone contacts everytime database when user login exceeding logged in time , not approach, if addressbook of iphone not modified database insertion happening on each loggin.
this how fetching contacts
nsarray *thepeople = (__bridge nsarray *)abaddressbookcopyarrayofallpeople(_addressbook); nsmutablearray * _allpeoplesdictarr = [nsmutablearray array]; (id person in thepeople) { abmultivalueref phones =(__bridge abmultivalueref)((__bridge nsstring*)abrecordcopyvalue((__bridge abrecordref)(person), kabpersonphoneproperty)); nsstring* name = (__bridge nsstring *)abrecordcopycompositename((__bridge abrecordref)(person)); abrecordref record = (__bridge abrecordref)[thepeople objectatindex:loop]; if(abrecordgetrecordtype(record) == kabpersontype) // check execute if person group { abrecordid recordid = abrecordgetrecordid(record); // record id address book record recordidstring = [nsstring stringwithformat:@"%d",recordid]; // record id string record id nsdate *modificationdate = (__bridge nsdate*) abrecordcopyvalue(record, kabpersonmodificationdateproperty); nslog(@"modificationdate %@",modificationdate); firstnamestring = (__bridge nsstring*)abrecordcopyvalue(record,kabpersonfirstnameproperty); // fetch contact first name address book lastnamestring = (__bridge nsstring*)abrecordcopyvalue(record,kabpersonlastnameproperty); // fetch contact last nslog(@"%@",firstnamestring); } }
i getting modification dates , can manage in array how know array changed when logged out or terminate application.
there approach can match each , every contacts modification date insertion or creation date present in sqlite database still comparing take time.
so isnt there way check md5checksum or addressbook on whole rather comparing each , every contacts creation date , insertion date. , if addressbook md5checksum modified insertion or updation need happens else dont.
you out of luck. if terminate application, there 0 public api let know there changes. going on contacts necessary, have no other way hear changes.
make sure open feature request @ https://bugreport.apple.com, letting them know api need. post bug report number in questio people can duplicate radar.
from comments of answer, here radar duplicate: rdar://16154022 (thanks oski555)
Comments
Post a Comment