Cannot assign value of type 'Foundation.Data' to type 'Appname.Data'

I have code for fetching the image data.The same code works fine in other projects but in this project i am getting this error.The code which causes the error is as given below:

 func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {                     let imageURL = info[UIImagePickerController.InfoKey.imageURL] as? URL                    let imagePath =  imageURL?.path                    print("imagepath is",imagePath)              _ = imageURL?.lastPathComponent                                    // self.camimgname = imageName                   //  self.finalimgname = self.camimgname                       var  chosenImage = UIImage()                       chosenImage = info[UIImagePickerController.InfoKey.originalImage] as! UIImage //2                       self.profileimg.contentMode = .scaleAspectFit //3                       self.profileimg.image = chosenImage //4                                    if let data = chosenImage.jpegData(compressionQuality: 0.5) {                                               // self.camdata = data                         self.imgdata = data                    }                                                dismiss(animated:true, completion: nil)             } 

The screenshot of the error is as given below:

enter image description here

What could be the issue with this Data.Is there any unwanted framework added or anything?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.