aarajput / wc_flutter_share

A Flutter plugin for sharing files & text with other applications.
Apache License 2.0
35 stars 19 forks source link

Cannot share image #6

Closed EHBradford closed 5 years ago

EHBradford commented 5 years ago

Just encountered this new issue on IOS. I believe the same issue may be happening on Android due to the same behavior shown in GUI. Have not run it in an environment to absolutely confirm this though.

  var request = await HttpClient().getUrl(Uri.parse(row.post_image_name));
    var response = await request.close();
    Uint8List thebytes = await consolidateHttpClientResponseBytes(response);
    await WcFlutterShare.share(
        sharePopupTitle: 'Title',
        subject: '',
        text: twitter_handle + share_url + ' (Title): ' + row.post_text,
        fileName: row.post_image_name,
        mimeType: row.image_mime_type,
        bytesOfFile: thebytes);

2019-08-08 21:12:13.817078-0500 Runner[3712:2052206] [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Cannot create file, path = '/var/mobile/Containers/Data/Application/CB343D7A-BA6C-4E37-A064-EAE6DDE51769/Library/Caches/https://www.xyzxyz.com/uimages/ex3/huh/6Cf/dxu/geA/9qctle68ab1a66s8lfksava434_id4afh9_1565310368.jpg' (OS Error: No such file or directory, errno = 2)

0 _File.create. (dart:io/file_impl.dart:263:9)

1 _rootRunUnary (dart:async/zone.dart:1132:38)

2 _CustomZone.runUnary (dart:async/zone.dart:1029:19)

3 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)

4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)

5 Future._propagateToListeners (dart:async/future_impl.dart:668:32)

6 Future._completeWithValue (dart:async/future_impl.dart:483:5)

7 Future._asyncComplete. (dart:async/future_impl.dart:513:7)

8 _rootRun (dart:async/zone.dart:1124:13)

9 _CustomZone.run (dart:async/zone.dart:1021:19)

10 _CustomZone.runGuarded (dart:async/zone.dart:923:7)

11 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)

12 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)

13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

Flutter doctor -v

/Users/tom/Downloads/flutter/bin/flutter doctor -v [✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-US) • Flutter version 1.7.8+hotfix.4 at /Users/tom/Downloads/flutter • Framework revision 20e59316b8 (3 weeks ago), 2019-07-18 20:04:33 -0700 • Engine revision fee001c93f • Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /Users/tom/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 10.3, Build version 10G8 • CocoaPods version 1.6.0

[✓] iOS tools - develop for iOS devices • ios-deploy 1.9.4

[✓] Android Studio (version 3.4) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 38.1.1 • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] Connected device (1 available) • iPhone Xʀ • D7ABF765-A875-4F2C-B532-381ACD49B754 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

Any ideas?

EHBradford commented 5 years ago

One thing that bothers me is that when I issue the pod install command I get the following:

pod install

Analyzing dependencies Fetching podspec for Flutter from .symlinks/flutter/ios-release Fetching podspec for audioplayers from .symlinks/plugins/audioplayers/ios Fetching podspec for camera from .symlinks/plugins/camera/ios Fetching podspec for esys_flutter_share from .symlinks/plugins/esys_flutter_share/ios Fetching podspec for firebase_messaging from .symlinks/plugins/firebase_messaging/ios Fetching podspec for flutter_native_image from .symlinks/plugins/flutter_native_image/ios Fetching podspec for image_crop from .symlinks/plugins/image_crop/ios Fetching podspec for image_cropper from .symlinks/plugins/image_cropper/ios Fetching podspec for image_gallery_saver from .symlinks/plugins/image_gallery_saver/ios Fetching podspec for image_picker from .symlinks/plugins/image_picker/ios Fetching podspec for keyboard_visibility from .symlinks/plugins/keyboard_visibility/ios Fetching podspec for multi_image_picker from .symlinks/plugins/multi_image_picker/ios Fetching podspec for native_device_orientation from .symlinks/plugins/native_device_orientation/ios Fetching podspec for package_info from .symlinks/plugins/package_info/ios Fetching podspec for path_provider from .symlinks/plugins/path_provider/ios Fetching podspec for qr_mobile_vision from .symlinks/plugins/qr_mobile_vision/ios Fetching podspec for shared_preferences from .symlinks/plugins/shared_preferences/ios Fetching podspec for sqflite from .symlinks/plugins/sqflite/ios Fetching podspec for url_launcher from .symlinks/plugins/url_launcher/ios Fetching podspec for vibration from .symlinks/plugins/vibration/ios Fetching podspec for video_player from .symlinks/plugins/video_player/ios Fetching podspec for wc_flutter_share from .symlinks/plugins/wc_flutter_share/ios Downloading dependencies Using BSGridCollectionViewLayout (1.2.3) Using BSImagePicker (2.10.0) Using BSImageView (1.0.3) Using FMDB (2.7.5) Using Firebase (6.1.0) Using FirebaseAnalytics (6.0.1) Using FirebaseAnalyticsInterop (1.2.0) Using FirebaseCore (6.0.1) Using FirebaseInstanceID (4.1.0) Using FirebaseMessaging (4.0.1) Using Flutter (1.0.0) Using GTMSessionFetcher (1.2.2) Using GoogleAppMeasurement (6.0.1) Using GoogleMobileVision (1.6.0) Using GoogleToolboxForMac (2.2.1) Using GoogleUtilities (6.1.0) Using Protobuf (3.7.0) Using Reachability (3.2) Using TOCropViewController (2.5.0) Using audioplayers (0.0.1) Using camera (0.0.1) Using esys_flutter_share (0.0.1) Using firebase_messaging (0.0.1) Using flutter_native_image (0.0.1) Using image_crop (0.0.1) Using image_cropper (0.0.1) Using image_gallery_saver (0.0.1) Using image_picker (0.0.1) Using keyboard_visibility (0.5.0) Using multi_image_picker (4.4.1) Using nanopb (0.3.901) Using native_device_orientation (0.0.1) Using package_info (0.0.1) Using path_provider (0.0.1) Using qr_mobile_vision (0.0.1) Using shared_preferences (0.0.1) Using sqflite (0.0.1) Using url_launcher (0.0.1) Using vibration (1.1.0) Using video_player (0.0.1) Using wc_flutter_share (0.0.1) Generating Pods project Integrating client project

My entry in the pub_spec.yaml file is as follows:

wc_flutter_share:

EHBradford commented 5 years ago

I realized pod install might not be the correct command, so I did a pod update and the output was: Updating local specs repositories $ /usr/bin/git -C /Users/tom/.cocoapods/repos/master fetch origin --progress remote: Enumerating objects: 37757, done.
remote: Counting objects: 100% (37757/37757), done.
remote: Compressing objects: 100% (324/324), done.
remote: Total 197078 (delta 37544), reused 37425 (delta 37425), pack-reused 159321 Receiving objects: 100% (197078/197078), 22.72 MiB | 3.32 MiB/s, done. Resolving deltas: 100% (131976/131976), completed with 10167 local objects. From https://github.com/CocoaPods/Specs 0e19a4d82f0..930b9e528c2 master -> origin/master

CocoaPods 1.8.0.beta.1 is available. To update use: sudo gem install cocoapods --pre [!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.8.0.beta.1

Analyzing dependencies Fetching podspec for Flutter from .symlinks/flutter/ios-release Fetching podspec for audioplayers from .symlinks/plugins/audioplayers/ios Fetching podspec for camera from .symlinks/plugins/camera/ios Fetching podspec for esys_flutter_share from .symlinks/plugins/esys_flutter_share/ios Fetching podspec for firebase_messaging from .symlinks/plugins/firebase_messaging/ios Fetching podspec for flutter_native_image from .symlinks/plugins/flutter_native_image/ios Fetching podspec for image_crop from .symlinks/plugins/image_crop/ios Fetching podspec for image_cropper from .symlinks/plugins/image_cropper/ios Fetching podspec for image_gallery_saver from .symlinks/plugins/image_gallery_saver/ios Fetching podspec for image_picker from .symlinks/plugins/image_picker/ios Fetching podspec for keyboard_visibility from .symlinks/plugins/keyboard_visibility/ios Fetching podspec for multi_image_picker from .symlinks/plugins/multi_image_picker/ios Fetching podspec for native_device_orientation from .symlinks/plugins/native_device_orientation/ios Fetching podspec for package_info from .symlinks/plugins/package_info/ios Fetching podspec for path_provider from .symlinks/plugins/path_provider/ios Fetching podspec for qr_mobile_vision from .symlinks/plugins/qr_mobile_vision/ios Fetching podspec for shared_preferences from .symlinks/plugins/shared_preferences/ios Fetching podspec for sqflite from .symlinks/plugins/sqflite/ios Fetching podspec for url_launcher from .symlinks/plugins/url_launcher/ios Fetching podspec for vibration from .symlinks/plugins/vibration/ios Fetching podspec for video_player from .symlinks/plugins/video_player/ios Fetching podspec for wc_flutter_share from .symlinks/plugins/wc_flutter_share/ios Downloading dependencies Using BSGridCollectionViewLayout (1.2.3) Using BSImagePicker (2.10.0) Using BSImageView (1.0.3) Using FMDB (2.7.5) Installing Firebase 6.6.0 (was 6.1.0) Installing FirebaseAnalytics 6.1.0 (was 6.0.1) Installing FirebaseAnalyticsInterop 1.3.0 (was 1.2.0) Installing FirebaseCore 6.2.0 (was 6.0.1) Installing FirebaseCoreDiagnostics (1.0.1) Installing FirebaseCoreDiagnosticsInterop (1.0.0) Installing FirebaseInstanceID 4.2.3 (was 4.1.0) Installing FirebaseMessaging 4.1.2 (was 4.0.1) Using Flutter (1.0.0) Using GTMSessionFetcher (1.2.2) Installing GoogleAppMeasurement 6.1.0 (was 6.0.1) Installing GoogleDataTransport (1.1.0) Installing GoogleDataTransportCCTSupport (1.0.1) Using GoogleMobileVision (1.6.0) Using GoogleToolboxForMac (2.2.1) Installing GoogleUtilities 6.2.4 (was 6.1.0) Installing Protobuf 3.9.0 (was 3.7.0) Using Reachability (3.2) Installing TOCropViewController 2.5.1 (was 2.5.0) Using audioplayers (0.0.1) Using camera (0.0.1) Using esys_flutter_share (0.0.1) Using firebase_messaging (0.0.1) Using flutter_native_image (0.0.1) Using image_crop (0.0.1) Using image_cropper (0.0.1) Using image_gallery_saver (0.0.1) Using image_picker (0.0.1) Using keyboard_visibility (0.5.0) Using multi_image_picker (4.4.1) Using nanopb (0.3.901) Using native_device_orientation (0.0.1) Using package_info (0.0.1) Using path_provider (0.0.1) Using qr_mobile_vision (0.0.1) Using shared_preferences (0.0.1) Using sqflite (0.0.1) Using url_launcher (0.0.1) Using vibration (1.1.0) Using video_player (0.0.1) Using wc_flutter_share (0.0.1) Generating Pods project Integrating client project Pod installation complete! There are 22 dependencies from the Podfile and 45 total pods installed.

When I look in the wc_flutter_share repository, in .symlinks/plugins/wc_flutter_share/ios, it seems to actually have the 0.1.1 version in there though.

EHBradford commented 5 years ago

Ok,

I determined the problem. In my code I used as a file a full path to a filename on a website. Apparently something has changed and a file cannot be opened any longer using that path.

So, I changed :

await WcFlutterShare.share( sharePopupTitle: 'Title', subject: '', text: twitter_handle + share_url + ' (Title): ' + row.post_text, fileName: row.post_image_name, mimeType: row.image_mime_type, bytesOfFile: thebytes);

To:

await WcFlutterShare.share( sharePopupTitle: 'Title', subject: '', text: twitter_handle + share_url + ' (Title): ' + row.post_text, fileName: "share.jpg", mimeType: row.image_mime_type, bytesOfFile: thebytes);

And everything now works fine.

Thank you for this great library, my apologies for my mistake. If you can delete this thread and desire to that would be fine with me.

aarajput commented 5 years ago

I am glad you find this plugin use full. I'll mark this issue as close.