ios - Using ABUnknownPersonViewController with an image crashes -


i'm trying create new address book entry name , image using abunknownpersonviewcontroller prompt whether information should added existing person or added new person. according address book programming guide , few postings here, i'm using following code:

abunknownpersonviewcontroller *view = [[abunknownpersonviewcontroller alloc] init]; view.unknownpersonviewdelegate = self;  cferrorref error = null;  // create new person record abrecordref person = abpersoncreate(); abrecordsetvalue(person, kabpersonfirstnameproperty, (__bridge cftyperef)(_nametextfield.text), &error); abrecordsetvalue(person, kabpersonnoteproperty, (__bridge cftyperef)(_descriptiontextfield.text), &error);  //nsdata *imagedata = uiimagejpegrepresentation(_image, 0.8); nsdata *imagedata = uiimagepngrepresentation(_image);  cfdataref dataref = (__bridge cfdataref)imagedata;  abrecordsetvalue(person, kabpersonimageformatoriginalsize, dataref, &error);  //  view.displayedperson = person;  view.allowsaddingtoaddressbook = yes;  uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:view]; uibarbuttonitem *donebutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(closeaddressbook)]; view.navigationitem.leftbarbuttonitem = donebutton;  navcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve;  [self presentmodalviewcontroller:navcontroller animated:yes]; 

when stepping through code, shows dataref initialized correctly 1.8mb image data. when running code, app crashed following error:

-[nsconcretemutabledata count]: unrecognized selector sent instance 0x77f7ce0 *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[nsconcretemutabledata count]: unrecognized selector sent instance 0x77f7ce0' 

the object in question imagedata object.

when leave out imagedata, app runs fine , creates new address book entry name.

any idea what's going on here?

try function set picture after make nsdata image.

abpersonsetimagedata (    abrecordref person,    cfdataref imagedata,    cferrorref *error ); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -