ios 8 Photos framework - replace photos not working -
ios 8 Photos framework - replace photos not working -
i'm playing around new ios 8 photos framework, trying edit existing photo in library replacing it's not replaced, if can see success log messages i've set.
here's code :
uiimage *output = [self.imageview.image appenddatewithlabel:label]; self.imageview.image = output; // self.info retrieve uiimagepickercontroller delegate method nsurl *asseturl = self.info[uiimagepickercontrollerreferenceurl]; phfetchresult *result = [phasset fetchassetswithalasseturls:@[asseturl] options:nil]; phasset *asset = result.firstobject; if ([asset canperformeditoperation:phasseteditoperationcontent]) { [asset requestcontenteditinginputwithoptions:nil completionhandler:^(phcontenteditinginput *contenteditinginput, nsdictionary *info) { phcontenteditingoutput *contenteditingoutput = [[phcontenteditingoutput alloc] initwithcontenteditinginput:contenteditinginput]; nsdata *outputdata = uiimagepngrepresentation(output); bool wrote = [outputdata writetourl:contenteditingoutput.renderedcontenturl options:nsdatawritingatomic error:nil]; if (wrote) { [[phphotolibrary sharedphotolibrary] performchanges:^{ phassetchangerequest *request = [phassetchangerequest changerequestforasset:asset]; request.contenteditingoutput = contenteditingoutput; } completionhandler:^(bool success, nserror *error) { // console output : 1 nslog(@"success : %@", @(success)); // console output : nil nslog(@"error : %@", error); }]; } }]; }
instead of replacing, i've tried create modified copy. worked well, see new modified photo in library.
someone faced issue ?
it seems filling adjustementdata
property of phcontenteditingoutput
object mandatory in order edit photo.
ios photos ios8
Comments
Post a Comment