Image not be picked in iOS simulator
1,064
You have to add the below permission in Info.plist
file in XCode.
Camera :
Key : Privacy - Camera Usage Description
Value : $(PRODUCT_NAME) camera use
Photo :
Key : Privacy - Photo Library Usage Description
Value : $(PRODUCT_NAME) photo use
Author by
Admin
Updated on December 22, 2022Comments
-
Admin over 1 year
I am using the below code to get pick image in flutter application, when the code is run on Android it works fine, but when the same code is run on iOS it crashes the app while tapping the button to pick the image. How should I resolve it?
ERROR I GET
Lost connection to device.
final ImagePicker _picker = ImagePicker(); Future getImage() async { print("get image"); PickedFile image = await _picker.getImage(source: ImageSource.gallery); if (image != null) { setState(() { final File file = File(image.path); avatarImageFile = file; isLoading = true; }); } }
-
Deepak Ror almost 4 yearswhat pub lib you using?
-
Admin almost 4 years@Haryanvi I am using pub.dev/packages/image_picker#-readme-tab-
-
Nikunj Kumbhani almost 4 years@JohnnyWarner Please try my answer
-
-
Admin almost 4 yearsI tried it , but it is till giving the same error, added the info.plist in the question above
-
Nikunj Kumbhani almost 4 years@JohnnyWarner Please share what's the error you got?
-
Nikunj Kumbhani almost 4 years@JohnnyWarner Please try to run in the real device after clean the project
-
Admin almost 4 yearsResolved it in simulator only by rebuilding the project
-
Abhishek Ghaskata over 3 yearsWhich simulator version are you using? I am getting the same issue after doing this answer. My simulator version is 14.2. @NikunjKumbhani