iphone - Correct way to set up an addressBook instance variable? -


maybe can answer 1 easily. working on iphone app info each row in cellforrowatindexpath creating new address book each time calling:

abaddressbookref addressbook = abaddressbookcreate();

this works fine other it's slow , not feel right creating new ab each row. created addressbook instance variable can't seem use without crashing. (program received signal: “exc_bad_access”.) imagine i'm not setting right, have have had no luck finding in documentation.

thanks million in advance can help.

in .h file did this:

abaddressbookref addressbook;   @property(nonatomic, readwrite) abaddressbookref addressbook; 

then in .m file:

-(id)initwithstyle:(uitableviewstyle)style {     if (self = [super initwithstyle:style]) {          addressbook = abaddressbookcreate();     }      return self; } 

when release addressbook cfrelease(addressbook) ? if memory not enough, abaddressbookcreate() return nil object. c-based addressbook.framework api cannot work nil object, , crash "exc_bad_access".


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -