I'm trying to write a feature that allows a user to select an image from their gallery on iOS. I'm able to capture the image from the camera, but when I try to do the same from the image gallery, my app crashes.
I made sure that I'm using the latest version of the plugin (0.6.0), and have tried running the app both in the simulator and on my iOS device. I'm currently using an iPhone 8 simulator running iOS 12.4, and my device is an iPhone 7+, also on iOS 12.4
// opens the camera for use, works as expected
// does not currently store the image anywhere, but I know why
void _showCamera() async {
var picture = await ImagePicker.pickImage(
source: ImageSource.camera
);
}
// this code crashes
void _showImageGallery() async {
var picture = await ImagePicker.pickImage(
source: ImageSource.gallery
);
}
If I call _showCamera() from my onTap: callback, the camera opens without issue. When I call _showImageGallery() from the exact same onTap: callback, the app crashes. I'd expect it to work the same since they're otherwise identical functions.
I think you missed adding the NSPhotoLibraryUsageDescription to the info.plist file
This issue exists on flutter stable channel. Switch to flutter beta channel to resolve this issue. Use this command to switch the flutter channel:
flutter channel beta
Related
Image stored in local libcachedimage not showing on real iOS device, below is the path where image is stored.
/Users/user***/Library/Developer/CoreSimulator/Devices/B8056AB3-B020-4520-A44E-B3C6E1F4B239/data/Containers/Data/Application/4FCE98E8-BD21-4A35-A79E-0B08EE931BCC/Library/Caches/libCachedImageData/5fa3e7e0-77fa-11ed-a821-d7297da5f84d.jpg'
But it's working with iOS emulator not on real device.
Thanks.
I have implemented code which will allow me to access the camera in my flutter application and it is working perfectly when the app is opened on android, but the app crashes and throws an exception when I open the same, on Chrome on Mac!
I am using camera package from flutter docs to access the camera!
import 'package:camera/camera.dart';
The exception occurs at this line:
List<CameraDescription> cameras = await availableCameras();
I don't know whether camera package supports on web or not, so if this is the case, can anyone suggest me an alternative, which I can use in web and a way how to write a condition, like if the app opened on web then the alternative camerapreview, else (on android) camerapreview from camera package
Edit - when I accept the permission of camera on chrome, the light of the webcam blinks and then the app crashes and points to the above line showcasing exception occurs
I am using a PictureRecorder variable from the dart:ui package for creating an image with this line of code:
final _image =
await pictureRecorder.endRecording().toImage(size, (size * 1.1).toInt());
It works fine with Flutter Android, Flutter iOS and also Flutter Web. But I experienced a problem with Flutter Web, if it is opened with any mobile device (iOS and Android).
The problem is that endRecording doesn't create an "Instance of CkPicture". Instead it creates an "Instance of Minified:vs", whatever that means. But only on Flutter Web if you open with a mobile phone.
And ideas for a fix or a workaround?
Here's a complete example for this code for converting an image to a png
Round Image File
Is there any way to detect if screen is getting captured for my app in flutter? I want to turn my screen black if any app/system is recoding screen while my app is active.
Is it possible in flutter?
try this plugin flutter_windowmanager
to prevent screen shot and video record
in main file :
disableCapure() async {
await FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE);
}
then call that method after runApp
void main(){
runApp(...);
disableCapure();
}
although for ios you have to know native code maybe it not work pretty for ios
Hi am developing a Emoji app with swift3 iOS 10. I have used a public library for playing the Gif files. It works perfectly in iOS simulators not in real device displaying an error message
Program ended with exit code: 9
I don't know what is wrong in it.
used this Library
My Code is
let testGifImage = UIImage.gifImageWithName("giphy")
cell.EmojiImage.image = testGifImage