Skip to content

[image_picker]On iOS13 device, pickVideo does not work. #41046

@Shunsuke-Satoh

Description

@Shunsuke-Satoh

1.Problem
pickVideo method returns a selected File.
But my App can not touch the File!
(file.copy(), file.readAsBytesSync() does not work.)

2.Source code

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: RaisedButton(
          onPressed: _showImagePicker,
          child: Text('Image Picker'),
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }

  void _showImagePicker() async {
    var image = await ImagePicker.pickVideo(source: ImageSource.gallery);
    print(image.path);
    print(image.statSync());
  }
}

3. plist
add below.

<key>NSMicrophoneUsageDescription</key>
<string>Test</string>
<key>NSCameraUsageDescription</key>
<string>Test</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Test</string>

4. yaml
add below.
image_picker: 0.6.1+4

5. Run And Select a File on Xcode And iOS13 device(Connected by USB)
[MyLogs]

2019-09-22 14:33:29.441392+0900 Runner[789:194590] flutter: /private/var/mobile/Containers/Data/PluginKitPlugin/2D965F91-7793-48FC-966A-8850E1976AE9/tmp/trim.4A522F8F-C4BC-4910-B4CE-3DB62A292BE6.MOV
2019-09-22 14:33:29.443625+0900 Runner[789:194590] flutter: FileStat: type notFound
          changed null
          modified null
          accessed null
          mode ---------
          size -1

5-a) Reason (I think)
Because the File path contains [PluginKitPlugin]Folder.
(App have No permission for the Directory)
Like [/private/var/mobile/Containers/Data/PluginKitPlugin/xxx/tmp/trim.xxx.MOV].

5-b) on iOS12
On iOS12 device, works fine!
Like[/private/var/mobile/Containers/Data/Application/xxx/tmp/xxx.MOV]

6. flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G95, locale ja-JP)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] Connected device (1 available)

• No issues found!

7. Please Help ...
Thank you for reading.

Metadata

Metadata

Assignees

Labels

c: regressionIt was better in the past than it is nowp: image_pickerThe Image Picker plugin.packageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions