fulldecent / fdtake Goto Github PK
View Code? Open in Web Editor NEWEasily take a photo or video or choose from library
License: MIT License
Easily take a photo or video or choose from library
License: MIT License
Hi,
I tried to use FDTake inside an UICustemTableViewCell
for a dynamic form.
My problem is that the button that instantiates the FDTakeController
in inside an UITableViewCell
. So the cell doesn't know its UIViewController
and I get an logical error of window hierarchy because I cannot initialise viewControllerForPresentingImagePickerController
.
Do you have an idea how I can use FDTake in this case ?
Regards.
If you click the cancel action in the action sheet, didDeny is called instead of didCancel.
I have a problem to save videos and photos to iCloud enabled Photo library. Is some ready solution out there?
Hi
I tried adding the library with pods and then
#import "FDTakeController.h"
in my bridging file but I get:
/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:9: note: in file included from /Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:
#import "FDTakeController.h"
^
/Users/dgomez/Desktop/Swift - Camera/Pods/Headers/Public/FDTake/FDTakeController.h:29:65: error: expected a type
- (void)takeController:(FDTakeController *)controller gotPhoto:(UIImage *)photo withInfo:(NSDictionary *)info;
^
/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:9: note: in file included from /Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:
#import "FDTakeController.h"
^
/Users/dgomez/Desktop/Swift - Camera/Pods/Headers/Public/FDTake/FDTakeController.h:37:41: error: cannot find protocol declaration for 'UIImagePickerControllerDelegate'
@interface FDTakeController : NSObject <UIImagePickerControllerDelegate>
^
/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:9: note: in file included from /Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:
#import "FDTakeController.h"
^
/Users/dgomez/Desktop/Swift - Camera/Pods/Headers/Public/FDTake/FDTakeController.h:59:42: error: unknown type name 'UIViewController'
@property (nonatomic, unsafe_unretained) UIViewController *viewControllerForPresentingImagePickerController;
^
/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:9: note: in file included from /Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:
#import "FDTakeController.h"
^
/Users/dgomez/Desktop/Swift - Camera/Pods/Headers/Public/FDTake/FDTakeController.h:61:31: error: unknown type name 'UITabBar'
@property (strong, nonatomic) UITabBar *tabBar;
^
/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:9: note: in file included from /Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h:5:
#import "FDTakeController.h"
^
/Users/dgomez/Desktop/Swift - Camera/Pods/Headers/Public/FDTake/FDTakeController.h:61:1: error: property with 'retain (or strong)' attribute must be of object type
@property (strong, nonatomic) UITabBar *tabBar;
^
<unknown>:0: error: failed to import bridging header '/Users/dgomez/Desktop/Swift - Camera/Swift - Camera/Swift - Camera-Bridging-Header.h'```
@property (nonatomic, copy) NSString *tag;
so,we can distinguish them when using
- (void)takeController:(FDTakeController *)controller gotPhoto:(UIImage *)photo withInfo:(NSDictionary *)info
.I will take two photos in a viewcontroller
Just run example on device and it throws the exception right away
Using an iPad Mini 2 running iOS 9.3.1 and building the example in XCode 7.3.
Running the example and then tapping 'Present from window' button causes the following crash:
Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x12c561280>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
Investigation lead me to this SO question suggesting extra properties are required for the popover on iPad, this makes sense because running the example on the iPhone 6s simulator worked fine.
UIActionSheet from Popover with iOS8 GM
I don't see a license for this project. Did you have one in mind?
Hello William,
I'm trying to use FDTake inside a view controller contained in a Tab Bar view controller as the root view controller.
When attempting to choose a photo I get the following error:
2013-01-21 11:42:40.923 Era[12394:c07] Warning: Attempt to present <UIImagePickerController: 0x9145060> on <UITabBarController: 0x76188d0> whose view is not in the window hierarchy!
Any advice?
Thank you very much,
Jorge Tapia
When suspending the app/dismissing a view it would be nice to have the option to dismiss the FDtake's ActionSheet.
Hi, thanks for a neat library.
I have placed the Localizable.strings
from the English and Danish under a Supporting Files
group, and I can see they have been added to en.lproj
and da.lproj
. I can see they are picked up:
The pop-up does not seem to be translated however, it will just say "takePhoto" for example. I know the Localizable.strings
files are working, because I have this line
label.text = NSLocalizedString("loading", comment: "The loading message when pulling data")
and that changes correctly if I choose Danish or English.
Any idea if I am doing something wrong here? I copied them into the project, no reference link. I do not use CocoaPods. Content of the English Localizable.strings
:
/* Decline to proceed with operation */
"cancel" = "Cancel";
/* Option to select photo from library */
"chooseFromLibrary" = "Choose from library";
/* Option to select photo from photo roll */
"chooseFromPhotoRoll" = "Choose from photo roll";
/* There are no sources available to select a photo */
"noSources" = "There are no sources available to select a photo";
/* Option to take photo using camera */
"takePhoto" = "Take photo";
/* Option to take video using camera */
"takeVideo" = "Take video";
/* The loading message when pulling data */
"loading" = "Loading...";
Thank you.
Hi
Swift is now available in cocoa pods pre:
TL;DR: CocoaPods 0.36 will bring the long-awaited support for Frameworks and Swift. It isn't released and considered stable yet, but a beta is now available for everyone via [sudo] gem install cocoapods --pre. Pod authors will especially want to try this version to make sure their pods will work with the upcoming release. This is because if a single dependency in a user's project requires being a framework, then your Pod will also become a framework.
From: http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/
After calling FDTake from a Modalview, It fires me:
<UIImagePickerController: 0x979d4b0> on <CustomTabBarControllerViewController: 0xb64ee60> whose view is not in the window hierarchy!
Where CustomTabBarControllerViewController is the rootview. The modal should fire the imagepicker, not the rootview, don't it?
I would like to add test cases but am not sure where to start.
Does anyone have experience with this and want to help out?
Is the image fetched from FDTake not meant to be decoded to NSString
via base64 encoding?
This was how I did the encoding:
[UIImageJPEGRepresentation(image, 1.0) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
[UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
And the decoding:
- (UIImage*) convertToImage {
NSData *data = [[NSData alloc]initWithBase64EncodedString:string options:NSDataBase64DecodingIgnoreUnknownCharacters];
return [UIImage imageWithData:data];
}
While the image can be encoded and then decoded immediately and still be shown on UIImageView
,
only ones that were create directly from stored image files can be decoded for tranference among systems. Is something wrong with images that are picked via FDTake?
EDIT: I'm using XCode 6.4, iOS 8.0
First I can see the camera, working then i push the "click" button and get a dark screen, even if the user agreed.
I get the following errors in the console (4 times):
CGAffineTransformInvert: singular matrix.
CGAffineTransformInvert: singular matrix.
CGAffineTransformInvert: singular matrix.
CGAffineTransformInvert: singular matrix.
=> [picker dismissModalViewControllerAnimated:YES]; is deprecated in iOS 6+
Hello,
I've recently changed way my pods are installed (added use_frameworks!
flag) and now strings are not localised (just getting standard keys like chooseFromLibrary
).
Is there a problem on my side or something that I need to change in the library?
I'm happy to prepare a PR if you let me know where this needs to be fixed.
Thanks, Kacper.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Sheet can not be presented because the view is not in a window: <UIView: 0xc765470; frame = (0 0; 768 1024); autoresize = RM+BM; layer = <CALayer: 0xc7654d0>>'
*** First throw call stack:
(
0 CoreFoundation 0x021945e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x01e3d8b6 objc_exception_throw + 44
2 UIKit 0x00f0659a -[UIActionSheet showInView:] + 0
3 UIKit 0x00f06a87 -[UIActionSheet showFromRect:inView:animated:] + 43
4 iPAYstPOS.test.ios7 0x00011b13 -[FDTakeController _setUpActionSheet] + 1811
5 iPAYstPOS.test.ios7 0x0000efa0 -[FDTakeController takePhotoOrChooseFromLibrary] + 1104
6 iPAYstPOS.test.ios7 0x000886f9 -[PanTerminalViewController handleBtnThumb:] + 441
7 libobjc.A.dylib 0x01e4f874 -[NSObject performSelector:withObject:withObject:] + 77
8 UIKit 0x00a2f0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
9 UIKit 0x00a2f04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
10 UIKit 0x00b270c1 -[UIControl sendAction:to:forEvent:] + 66
11 UIKit 0x00b27484 -[UIControl _sendActionsForEvents:withEvent:] + 577
12 UIKit 0x00b26733 -[UIControl touchesEnded:withEvent:] + 641
13 UIKit 0x00a6c51d -[UIWindow _sendTouchesForEvent:] + 852
14 UIKit 0x00a6d184 -[UIWindow sendEvent:] + 1232
15 UIKit 0x00a40e86 -[UIApplication sendEvent:] + 242
16 UIKit 0x00a2b18f _UIApplicationHandleEventQueue + 11421
17 CoreFoundation 0x0211d83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15
18 CoreFoundation 0x0211d1cb __CFRunLoopDoSources0 + 235
19 CoreFoundation 0x0213a29e __CFRunLoopRun + 910
20 CoreFoundation 0x02139ac3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x021398db CFRunLoopRunInMode + 123
22 GraphicsServices 0x045b59e2 GSEventRunModal + 192
23 GraphicsServices 0x045b5809 GSEventRun + 104
24 UIKit 0x00a2dd3b UIApplicationMain + 1225
25 iPAYstPOS.test.ios7 0x000c978d main + 141
26 libdyld.dylib 0x027be70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Because we look dated
On iPad this pod is working fine in portrait mode, however when presenting the popover controller in landscape mode the camera view is still in portrait. Taking a picture in landscape mode with the viewfinder in portrait, sets the image correct in landscape. So the problem is only occurring while finding your target.
From what i can find on google, maybe this is a Apple thing with the UIImagePickerController.
Chose from library?
Any one know how to fix or is it an iOS bug?
iOS7 beta6.
build with iOS6 SDK.
This will bump up iOS requirement to 7.0.
Video is not getting save when we record from this app.
I could not see, this selector method
- (void)takeController:(FDTakeController *)controller gotVideo:(NSURL *)video withInfo:(NSDictionary *)info
Am I missing anything, thanks
It would be nice to see in next updates:
@property (nonatomic) float videoMaximumDuration
} else if (actionSheet.tag == kVideosActionSheetTag) {
self.imagePicker.allowsEditing = self.allowsEditingVideo;
self.imagePicker.mediaTypes = @[(NSString *) kUTTypeMovie];
self.imagePicker.videoMaximumDuration = self.videoMaximumDuration;
The example has the same issue.
This is in Cocoapods.
please release a new version with the fix in commit 3119d33 , as automatic pod updates break FDTake.
Filelistings (sorry, no formatting or indentation:)
FDTake 0.2.2:
FDTakeExample:
FDTakeController.h
FDTakeController.m
LICENSE
README.md
FDTake 0.2.3:
FDTakeExample:
ar.lproj:
FDTake.strings
da.lproj:
FDTake.strings
de.lproj:
FDTake.strings
el.lproj:
FDTake.strings
en.lproj:
FDTake.strings
InfoPlist.strings
MainStoryboard_iPad.storyboard
MainStoryboard_iPhone.storyboard
es.lproj:
FDTake.strings
FDTakeController.h
FDTakeController.m
fr.lproj:
FDTake.strings
he.lproj:
FDTake.strings
nb.lproj:
FDTake.strings
nl.lproj:
FDTake.strings
pl.lproj:
FDTake.strings
pt.lproj:
FDTake.strings
ru.lproj:
FDTake.strings
sv.lproj:
FDTake.strings
tr.lproj:
FDTake.strings
zh-Hans.lproj:
FDTake.strings
zh-Hant.lproj:
FDTake.strings
LICENSE
README.md
I'm receiving a memory warning after taking a picture and when opening the take photo multiple times. Has anyone else experience this?
I'm also receiving "Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates." when opening the take photo.
This is test on iOS7 with an iPhone 5s and iPhone 4s.
Ability to require a certain size result. User will choose a crop box on the photo and then the result will be scaled to the exact dimensions you want.
Main use: selecting a profile photo which has to be AxB pixels.
Anyone else believe this feature belongs in this library?
Hey. Can you add polish translation? Here are translated strings:
/* Decline to proceed with operation */
"cancel" = "Anuluj";
/* Option to select photo from library */
"chooseFromLibrary" = "Wybierz z galerii";
/* Option to select photo from photo roll */
"chooseFromPhotoRoll" = "Wybierz z rolki aparatu";
/* There are no sources available to select a photo */
"noSources" = "Brak źródła, z którego można by wybrać zdjęcie";
/* Option to take photo using camera */
"takePhoto" = "Zrób zdjęcie";
/* Option to take video using camera */
"takeVideo" = "Nagraj film";
Here is the problem I have. I take a picture on my iPhone 5 on the camera and email it to myself. If i go to upload it to a blog or facebook it is always turned sideways. I have to open it on preview and re-save it so it has the correct orientation (even though i did not make any changes).
where as landscape images are fine.
It would be nice if it was possible to switch between fullscreen and popover view modes on iPad.
HI When I have tried to build using Cocoapods,
I have set my build target to 8.0 but I get this error when trying to build:
Module file's minimum deployment target is ios8.0 v8.0:
Any ideas how to resolve?
If not using the static library (cocoapods), the delegate can get fired only ONCE, which is the first photo capture:
BUT
If using FDTake static library (copy/paste), delegate got fired everytime I take new photo.
I have just tried the latest version and it works great for iphone, but when using an ipad (iOS 7) with photo editing enabled, the photos are quite small! Is there any way to fix this?
Currently it will show both the UIActionSheet
and UIPopoverController
at the top left of the screen on iPad. This is because UIBarButtonItem
inherits from NSObject
instead of UIView
because of legacy...
Found this code snippet somewhere for UIPopoverController
:
if ([sender isKindOfClass:[UIBarButtonItem class]]) {
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[popoverController presentPopoverFromRect:((UIView *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
For UIActionSheet
you need to use showFromBarButtonItem
:
[self.actionSheet showFromBarButtonItem:self.barButtonItem animated:YES];
Can you also change to use the sender
by default instead of us having to manually set it?
I would do a pull request, but I'm a total beginner with Objective-C.
Can you invoke Camera (video and Photo) in medium resolution mode. (i.e) A x B size (640x480).
Bcoz, few minutes video takes much MB to post it to server
error: [Xcode-DerivedData]/[Project]/Build/Products/Debug-iphonesimulator/FDTake/FDTake.bundle: No such file or directory
Works before on 7.2
Many Applications nowadays offer
I use the first option all the time. It would be swell if FDTake would offer this feature.
Thanks first for this simple and light library.
I got a error on Presenting FDTake FROM a PRESENTED TableViewController.
2014-04-26 14:23:39.069 Group2Study[217:60b] Warning: Attempt to present UIImagePickerController: 0x14454a880 on NavigationViewController: 0x14452f900 whose view is not in the window hierarchy!
NavigationViewController is a subclass of UINavigationController. It's from REMenu (https://github.com/romaonthego/REMenu).
Any Idea how I can solve it?
to be much easier to copy/paste the Pod, please replace
pod "FDTake"
with:
pod 'FDTake'
thanks ;)``
I would like to support Carthage.
Have never used it, hoping someone could help with a PR for this.
Hello,
The cancel button is not showing in imagePickerController on iOS 7.
Found this bug while trying out the demo app (FDTakeExample) on iOS 8.1.
The UIImagePickerController's delegate is reset to nil every time the controller FDTakeController is used. This means that the demo app only works once. On subsequent taps of takePhotoOrChooseFromLibrary: the picture taken does not end up in the UIImageView.
As a workaround, you can reinitialize the FDTakeController every time you use it.
Is it possible to add the option of manually setting the text for these buttons? I already have strings files for various languages and would prefer not to add clutter to my project by adding your strings files. Maybe add NSString properties for those which will override the strings files text if set?
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.