Coder Social home page Coder Social logo

Comments (4)

cuixiaocun avatar cuixiaocun commented on June 11, 2024 1

Device: iPhone Xs (16.6.1) image_pickers: ^2.0.4+3

I'm getting NSInvalidArgumentException when retrieving some media (not a clear pattern here) in iOS devices

I have this simple function on my repo

  Future<Either<Failure, List<dynamic>>>
      performGetObjectListFromDevice() async {
    try {
      log.fine(
          'MediaService called for retrieval of media objects from device');
      final List<dynamic> objectsList =
          await mediaServices.getObjectsListFromDevice();
      log.fine(
          'MediaService Successfully retrieved ${objectsList.length} media objects from device');
      return Right(objectsList);
    } on MediaServiceException catch (e) {
      log.warning('MediaServiceException encountered: ${e.message}');
      return const Left(ServerFailure(
          message: "Couldn't retrieve list of media from device"));
    }
  }

Which calls

@override
Future<List<dynamic>> getObjectsListFromDevice() async {
  List<imagePickers.Media> listVideoPaths = [];
  try {
    listVideoPaths = await imagePickers.ImagePickers.pickerPaths(
      galleryMode: imagePickers.GalleryMode.all,
      videoSelectMaxSecond: 1200,
      videoRecordMaxSecond: 1200,
      selectCount: 10,
    );
  } on Exception catch (e) {
    log.severe(
        'imagePickers library failed to return pickersPath\n--imagePickers: $e');
    rethrow;
  }
  return listVideoPaths;
}

As you can see in the log below, execution brakes when calling ImagePickers.pickerPaths()

== LOG ==

flutter: [MemoriesRepositoryImpl] FINE: 2023-10-14 13:54:57.349108: MediaService called for retrieval of media objects from device
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x197380cb4 0x1904203d0 0x19165f8c0 0x19165f63c 0x1012add0c 0x1012ad2c8 0x1ac3f5f60 0x19e856fc4 0x19e847eac 0x19e84b330 0x19e84a998 0x19e859944 0x19e85a158 0x1f71b5da0 0x1f71b5b7c)
libc++abi: terminating due to uncaught exception of type NSException
* thread #43, queue = 'com.apple.photos.requestAVAsset', stop reason = signal SIGABRT
    frame #0: 0x00000001d633d578 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1d633d578 <+8>:  b.lo   0x1d633d598               ; <+40>
    0x1d633d57c <+12>: pacibsp
    0x1d633d580 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1d633d584 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.

此问题,新的版本已更新,请更新一下代码,具体请见2.0.4+5

from image_pickers.

ppbrasil avatar ppbrasil commented on June 11, 2024

FYI: After calling ImagePickers.pickerPaths() but before selection is confirmed (done is clicked) I get the following message in the debug console

flutter: [GetObjectsListFromDeviceUseCase] FINE: 2023-10-14 14:33:38.422599: MemoriesRepository performGetObjectListFromDevice call with no Params
flutter: [MemoriesRepositoryImpl] FINE: 2023-10-14 14:33:38.423265: MediaService called for retrieval of media objects from device
[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
[PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x2817728a0> accessor:<<PAApplication 0x28174cd20 identifierType:auditToken identifier:{pid:4872, version:13663}>> identifier:A64DED7B-B144-4D1E-9941-B3E021FBF668 kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 3358 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 3358 named com.apple.privacyaccountingd}

As per the instructions, my plist is set as


<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>Needed for you to create videos and photo memories</string>
<key>NSMicrophoneUsageDescription</key>
<string>Needed for you to add sound to your videos memories</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Needed for you to upload your media</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Needed for you to record new media</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>

from image_pickers.

cuixiaocun avatar cuixiaocun commented on June 11, 2024

you can also add permissions
PHPhotoLibraryPreventAutomaticLimitedAccessAlert

although this is not the solution to the problem
[PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x2817728a0>
or You can ignore this issue.
This warning will not affect the normal operation of your program

FYI: After calling ImagePickers.pickerPaths() but before selection is confirmed (done is clicked) I get the following message in the debug console

flutter: [GetObjectsListFromDeviceUseCase] FINE: 2023-10-14 14:33:38.422599: MemoriesRepository performGetObjectListFromDevice call with no Params
flutter: [MemoriesRepositoryImpl] FINE: 2023-10-14 14:33:38.423265: MediaService called for retrieval of media objects from device
[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
[PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x2817728a0> accessor:<<PAApplication 0x28174cd20 identifierType:auditToken identifier:{pid:4872, version:13663}>> identifier:A64DED7B-B144-4D1E-9941-B3E021FBF668 kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 3358 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 3358 named com.apple.privacyaccountingd}

As per the instructions, my plist is set as


<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>Needed for you to create videos and photo memories</string>
<key>NSMicrophoneUsageDescription</key>
<string>Needed for you to add sound to your videos memories</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Needed for you to upload your media</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Needed for you to record new media</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>

you can also add permissions
PHPhotoLibraryPreventAutomaticLimitedAccessAlert

although this is not the solution to the problem
[PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x2817728a0>
or You can ignore this issue.
This warning will not affect the normal operation of your program

from image_pickers.

ppbrasil avatar ppbrasil commented on June 11, 2024

First of all, congrats on you guys fro the super fast response on those issues.

While release ^2.0.4+5 solved the crashing issue it generated a new one.
Now I'm facing several timeouts when selecting images. Unfortunately, I couldn't find a clear pattern to share with you guys. I had time out alerts while selecting one single image in the same compass that I have succeeded selecting some videos (up to 30secs).

FYI (1): In case it help, the progress indicator changed. It used to a progress indicator per selected tile and now is a generic one for the whole screen. And it's triggered not by individual selections but by clicking "done".

FYI (2): I had to pod update ZLPhotoBrowser so the code could compile

from image_pickers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.