ios - Swift - UIImagePickerController - didFinishPickingMediaWithInfo return nil -


i have take captured image url. didfinishpickingmediawithinfo returns nil. problem didfinishpickingmediawithinfo nil , request need url of captured image.

this code.

  func capturenewimage() {     if uiimagepickercontroller.issourcetypeavailable(.camera) {         let imagepickercontroller = uiimagepickercontroller()         imagepickercontroller.sourcetype = .camera         imagepickercontroller.cameracapturemode = .photo         imagepickercontroller.mediatypes = [kuttypeimage string]         imagepickercontroller.delegate = self         presentviewcontroller(imagepickercontroller, animated: true, completion: nil)     }     else {         print("camera not available")     } }       func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) {     print(info); // return values see below     print(info[uiimagepickercontrollerreferenceurl]) //return nill - problem here      if (picker.cameracapturemode == .photo){          let imageurl          = info[uiimagepickercontrollerreferenceurl] as! nsurl         let imagename         = imageurl.lastpathcomponent         let documentdirectory = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true).first string!         let photourl          = nsurl(fileurlwithpath: documentdirectory)         let localpath         = photourl.urlbyappendingpathcomponent(imagename!)         let image             = info[uiimagepickercontrolleroriginalimage]as! uiimage         let data              = uiimagepngrepresentation(image)          self.selectedvideofilepath = info[uiimagepickercontrollerreferenceurl] as! nsurl         customphotoalbum.sharedinstance.saveimage(self.selectedvideofilepath)      }else{          self.selectedvideofilepath = info[uiimagepickercontrollermediaurl] as! nsurl         customphotoalbum.sharedinstance.savevideo(self.selectedvideofilepath)      }      dismissviewcontrolleranimated(true) { () -> void in         self.performseguewithidentifier("showmetadatasegue", sender: self)     } } 

here info param returns

    ["uiimagepickercontrolleroriginalimage": <uiimage: 0x17f587d0> size {2448, 3264} orientation 3 scale 1.000000, "uiimagepickercontrollermediametadata": { dpiheight = 72; dpiwidth = 72; orientation = 6; "{exif}" =     {     aperturevalue = "2.526068811667587";     brightnessvalue = "0.8999723109936938";     colorspace = 1;     datetimedigitized = "2016:05:09 15:48:39";     datetimeoriginal = "2016:05:09 15:48:39";     exposurebiasvalue = 0;     exposuremode = 0;     exposureprogram = 2;     exposuretime = "0.05";     fnumber = "2.4";     flash = 24;     focallenin35mmfilm = 33;     focallength = "4.12";     isospeedratings =         (         320     );     lensmake = apple;     lensmodel = "iphone 5 camera 4.12mm f/2.4";     lensspecification =         (         "4.12",         "4.12",         "2.4",         "2.4"     );     meteringmode = 5;     pixelxdimension = 3264;     pixelydimension = 2448;     scenetype = 1;     sensingmethod = 2;     shutterspeedvalue = "4.321956949076723";     subjectarea =         (         1631,         1223,         1795,         1077     );     subsectimedigitized = 508;     subsectimeoriginal = 508;     whitebalance = 0; }; "{makerapple}" =     {     1 = 4;     20 = 1;     3 =         {         epoch = 0;         flags = 1;         timescale = 1000000000;         value = 17977926382791;     };     4 = 0;     5 = 221;     6 = 210;     7 = 1;     8 =         (         "-0.0007734549",         "-0.9098752",         "-0.3961896"     ); }; "{tiff}" =     {     datetime = "2016:05:09 15:48:39";     make = apple;     model = "iphone 5";     resolutionunit = 2;     software = "9.2.1";     xresolution = 72;     yresolution = 72; };  }, "uiimagepickercontrollermediatype": public.image] 

really couldnt find way image url.

suggest solution, may missed functions here.

thanks in advance


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -