uiactivityviewcontroller - How to export Apple's new RAW photo format .dng in iOS 10? -


i'm having trouble exporting apple's new raw photo format .dng.

uiactivityviewcontroller exports photo jpeg, defeats purpose.

any appreciated.

here's how fixed issue.

-(void)activityaction{ phasset *asset = self.assetsfetchresults[(int)self.image_number];  phimagerequestoptions *options = [[phimagerequestoptions alloc] init]; options.synchronous = no; options.version = phimagerequestoptionsversioncurrent; options.deliverymode = phimagerequestoptionsdeliverymodeopportunistic; options.resizemode = phimagerequestoptionsresizemodenone; options.networkaccessallowed = no;//has yes download cloud , progress show /*options.progresshandler =  ^(double progress,nserror *error,bool* stop, nsdictionary* dict) {     nslog(@"progress %lf",progress);  //never gets called };*/  [[phimagemanager defaultmanager] requestimagedataforasset:asset options:options resulthandler:^(nsdata *imagedata, nsstring *datauti, uiimageorientation imageorientation, nsdictionary *info){      nsurl *asseturl = [info objectforkey:@"phimagefileurlkey"];     nsstring *photoformat = [asseturl pathextension];      nsurl *temporarydngfileurl;      nsarray *activityitems;      if([photoformat isequaltostring:@"dng"] && [[uidevice currentdevice].systemversion floatvalue] >= 10){         nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);         nsstring *documentsdirectory = [paths objectatindex:0];         nsdateformatter *format = [[nsdateformatter alloc] init];         [format setdateformat:@"mmddyyyyhhmmss"];         nsstring *assetdatestring = [format stringfromdate:[nsdate date]];         nsstring *assetpath = [documentsdirectory stringbyappendingpathcomponent:[assetdatestring stringbyappendingstring:@".dng"]];         temporarydngfileurl = [nsurl fileurlwithpath:assetpath];         [imagedata writetourl:temporarydngfileurl atomically:yes];          activityitems = @[temporarydngfileurl];     }     else{         uiimage *shareimage = [[uiimage alloc] initwithdata:imagedata];          activityitems = @[shareimage];     }      uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems applicationactivities:nil];     activityvc.excludedactivitytypes = @[uiactivitytypesavetocameraroll];     activityvc.modaltransitionstyle = uimodaltransitionstylecoververtical;     [self presentviewcontroller:activityvc animated:yes completion:nil];      [activityvc setcompletionwithitemshandler:^(nsstring *activitytype, bool completed, nsarray *returneditems, nserror *activityerror) {         nsstring *servicemsg = nil;         if( [activitytype isequaltostring:uiactivitytypemail] )           servicemsg = @"mail done";         if( [activitytype isequaltostring:uiactivitytypemessage] ) servicemsg = @"message done";         if( [activitytype isequaltostring:uiactivitytypeairdrop] ) servicemsg = @"airdrop done";         if( [activitytype isequaltostring:uiactivitytypeposttotwitter] )  servicemsg = @"twitter done";         if( [activitytype isequaltostring:uiactivitytypeposttofacebook] ) servicemsg = @"facebook done";         if( [activitytype isequaltostring:uiactivitytypeposttoflickr] ) servicemsg = @"flickr done";         if( [activitytype isequaltostring:uiactivitytypeposttotencentweibo] ) servicemsg = @"weibo done";          if(completed){             [customactivityactionpressedtimer invalidate];             customactivityactionpressedtimer = nil;             customactivityaction = 0;             [[nsuserdefaults standarduserdefaults] setinteger:0 forkey:@"customactivityaction"];              nslog(@"activity view done");              if([[nsfilemanager defaultmanager] fileexistsatpath:temporarydngfileurl.path]){                 nserror *error;                 [[nsfilemanager defaultmanager] removeitematpath:temporarydngfileurl.path error:&error];                 if(error){                     nslog(@"raw dng file delete failed");                 }                 else{                     nslog(@"raw dng file deleted");                 }             }         }         else{             [customactivityactionpressedtimer invalidate];             customactivityactionpressedtimer = nil;             customactivityaction = 0;             [[nsuserdefaults standarduserdefaults] setinteger:0 forkey:@"customactivityaction"];              nslog(@"activity view cancel");              if([[nsfilemanager defaultmanager] fileexistsatpath:temporarydngfileurl.path]){                 nserror *error;                 [[nsfilemanager defaultmanager] removeitematpath:temporarydngfileurl.path error:&error];                 if(error){                     nslog(@"raw dng file delete failed");                 }                 else{                     nslog(@"raw dng file deleted");                 }             }         }     }]; }]; 

}


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -