IKSaveOptions saving images error when app is sandboxed


good morning!

save images in app using imagekit iksaveoptions present save panel accessory view deals different image settings.


if in save panel user select existing file, appears alert box "“xxx” exists. want replace it?".
if user press "replace" button, old file should replaced (overwritten) new one

works fine when app not sandboxed.
however, started use lion's sandbox "read/write access" entitlement. old file can not replaced correctly. old file kept , new file created. , new file name 'xxx.jpg.sb-g5evhc'. think kind of sandbox format file. not want. want replace old image file new one.

tried again: old image file can correctly replaced if app not sandboxed, can not replaced if app sandboxed.

please help! appriciated.



used sample code of 'ikimageviewdemo' can found on webpage
http://developer.apple.com/library/.../dts10004049-controller_m-dontlinkelementid_4
, code below:
///////////////////////////////////////////////////////////////////////////////////////////////

code:
 - (void)savepaneldidend: (nssavepanel *)sheet               returncode: (int)returncode              contextinfo: (void *)contextinfo  {      // save image            if (returncode == nsokbutton)      {          nsstring * path = [sheet filename];          nsstring * newuttype = [_saveoptions imageuttype];          cgimageref image;                // current image image view          image = [_imageview image];                    if (image)          {              // use imageio save image in user specified format              nsurl *               url = [nsurl fileurlwithpath: path];              cgimagedestinationref dest = cgimagedestinationcreatewithurl((cfurlref)url, (cfstringref)newuttype, 1, null);                            if (dest)              {                  cgimagedestinationaddimage(dest, image, (cfdictionaryref)[_saveoptions imageproperties]);                  cgimagedestinationfinalize(dest);                  cfrelease(dest);              }          } else          {              nslog(@"*** saveimagetopath - no image");          }      }  }     // ---------------------------------------------------------------------------------------------------------------------  - (ibaction)saveimage: (id)sender  {      // present save panel - use iksaveoptions append imagekit accessory view save panel      nssavepanel * savepanel = [nssavepanel savepanel];            _saveoptions = [[iksaveoptions alloc] initwithimageproperties: _imageproperties                                                        imageuttype: _imageuttype];            [_saveoptions addsaveoptionsaccessoryviewtosavepanel: savepanel];            nsstring * filename = [[_window representedfilename] lastpathcomponent];            [savepanel beginsheetfordirectory: null                                   file: filename                         modalforwindow: _window                          modaldelegate: self                         didendselector: @selector(savepaneldidend:returncode:contextinfo:)                             contextinfo: null];    
///////////////////////////////////////////////////////////////////////////////////////////////

jacky
 

any 1 please?

 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Mac OS X Server as File Server for 50/50 Mac & PC Workgroup

Permissions Problem?

iPhone won't sync with iTunes