kmorkos / flutter_photokit Goto Github PK
View Code? Open in Web Editor NEWFlutter plugin to interact with iOS PhotoKit
License: Other
Flutter plugin to interact with iOS PhotoKit
License: Other
When running your example on my iPhone simulator (iPhone XS Max • 6F9DE665-62D8-4DCC-A47B-CA97DAF9BD01 • ios • iOS 12.0 (simulator)
) it crashes:
git clone [email protected]:kmorkos/flutter_photokit.git
cd flutter_photokit/example
flutter run -d 'iPhone XS Max'
When clicking the 'save to camera roll' button, it crashes. From within my own project I found out that it crashes on the line of FlutterPhotokit.saveToCameraRoll
. But I cannot get any further feedback unfortunately, because of Lost connection to device. Exited (sigterm).
[✓] Flutter (Channel beta, v0.9.4, on Mac OS X 10.13.6 17G65, locale en-NL)
• Flutter version 0.9.4 at /Users/rogier/DEV/flutter
• Framework revision f37c235c32 (4 weeks ago), 2018-09-25 17:45:40 -0400
• Engine revision 74625aed32
• Dart version 2.1.0-dev.5.0.flutter-a2eb050044
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/rogier/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 27.0.3
• ANDROID_HOME = /Users/rogier/Library/Android/sdk
• 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-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 29.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.28.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.19.0
[✓] Connected devices (2 available)
• G8231 • QV700E8M0K • android-arm64 • Android 8.0.0 (API 26)
• iPhone XS Max • 6F9DE665-62D8-4DCC-A47B-CA97DAF9BD01 • ios • iOS 12.0 (simulator)
• No issues found!
Hey @kmorkos.
Thanks for this great plugin!
I open this issue as I ran into problems after adding it to my project. As it turned out the problem occurred because my project wasn't create with Swift support.
After some time searching I found the issue #16049 on the flutter repository, and by fiddling around with what is suggested, I could finally make my project build and run again, successfully using your plugin.
I think it could be worth mentioning in your docs that this problem exists, and how to resolve it.
Cheers!
Hi - I've just upgraded Android Studio, and I'm now getting the following issue:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'flutter_photokit' is using version 1.2.3
Any chance you could release a patch upgrade that ups the ext.kotlin_version
?
Many thanks
Nic
When I try to use the plugin, I get this on build:
Launching lib/main.dart on iPhone XS Max in debug mode...
Xcode build done. 7.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/rogier/DEV/flutter/.pub-cache/git/flutter_photokit-44756eeeec487a686f9c301437a6251dde7877aa/ios/Classes/FlutterPhotokitPlugin.m:2:9: fatal error: 'flutter_photokit/flutter_photokit-Swift.h' file not found
#import <flutter_photokit/flutter_photokit-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Somehow flutter_photokit/flutter_photokit-Swift.h
is not found, any ideas?
I'm looking to actually do the opposite. I'm looking to retrieve images saved from the camera roll. I have the path, but I'm not able to "get" that path. Just keeps saying "Cannot open file, path". This is the path too so not sure why not.
/private/var/mobile/Media/DCIM/100APPLE/
From the path I'm using this: Image image = Image.file(File(path)); but apparently that doesn't work.
I got an exception when trying to save an image to the camera roll (similar error also when I try to save to an album).
Source code available here: https://github.com/danyf90/DFNightSelfies
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(save_asset_error, Could not save the asset, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)
#2 FlutterPhotokit.saveToCameraRoll (package:flutter_photokit/flutter_photokit.dart:34:24)
#3 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#4 FlutterPhotokit.saveToCameraRoll (package:flutter_photokit/flutter_photokit.dart:30:39)
#5 _DfNightSelfiesMainState.saveMedia (package:dfnightselfies/main.dart:375:23)
#6 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#7 _DfNightSelfiesMainState.saveMedia (package:dfnightselfies/main.dart:361:19)
#8 _DfNightSelfiesMainState.getButtons. (package:dfnightselfies/main.dart:249:21)
#9 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#10 _DfNightSelfiesMainState.getButtons. (package:dfnightselfies/main.dart:247:24)
#11 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:635:14)
#12 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:711:32)
#13 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#14 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
#15 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:312:7)
#16 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
#17 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
#18 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
#19 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
#20 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
#21 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
#22 _rootRunUnary (dart:async/zone.dart:1136:13)
#23 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#25 _invoke1 (dart:ui/hooks.dart:250:10)
#26 _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)
Hi @kmorkos
The Plugin helps me a lot.
I am trying to return the saved path (i have used save to album) so that I will use the same URL to render in the image view instead of returning the boolean value.
PHImageManager().requestImage(for: fetchResult!, targetSize: CGSize.init(), contentMode: PHImageContentMode.default, options: PHImageRequestOptions?.init(nilLiteral: ()), resultHandler: { (image:UIImage!,some:Any?) in
print("printing url *********--->>>>")
print(image)
})
my print statement is here
printing url *********--->>>>
some(<UIImage: 0x1c42ad440> size {90, 120} orientation 0 scale 1.000000)
any Idea to return the path of the image
I have been looking to do this for a long time
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.