Discuss Two questions about taking pictures via CameraController at the Free Toolchain Software (Cydia App's) - Hackint0sh.org; I'm trying to take pictures via my camera without using the official camera funtions in ...
Two questions about taking pictures via CameraController
I'm trying to take pictures via my camera without using the official camera funtions in the official SDK.
Therefor i dumped some classes from "PhotoLibary" using class-dump. I followed some tutorials which i found on the internet and read in the book "iPhone Open Application Development".
With the code below i can succesfully build the application without any errors and warnings. When i click on the button "Take photo" nothing happens, i've placed some NSLogs to see what happens and i see the methods "cameraControllerReadyStateChanged" and "tookPicture" being executed. My tookPicture funtions looks like:
As you can see i'm trying to write the file to "/var/root/Media/Photo/Photo_1.JPG". The directory does exists and i've chmod the directory to 777. The problem is nothing being writed out there, no picture is taken... There are no errors and/or warnings in my console when i'm trying to take a photo. So i really don't know where to look.
- (void)cameraController:(id)sender tookPicture:(UIImage*)picture withPreview:(UIImage*)preview jpegData:(NSData*)rawData imageProperties:(struct __CFDictionary *)imageProperties
NSLog(@"::cameraController method executed");
NSAutoreleasePool* pool = [NSAutoreleasePool new];
imageName = @"1";
imagePath = [NSString stringWithFormat:@"/var/root/Media/Photo/Photo_%@.JPG", imageName];
logPrefix = @"Trying to write the picture to: ";
[rawData writeToFile: imagePath atomically: NO];
The following code is being executed when i click on the button "Take Picture":
Another question, i've also a button called "Enable camera". My idea about this is when i click on this button, a sort of preview mode is being started. I've created a UIImage thing with Interface Builder and made a class outlet of this UIImage. How can i "print" the current camera view into this UIImage?
NSLog(@"::takePicture method executed");
CameraController *camera = [ [ CameraController alloc ] init ];
[camera setDelegate: self];
Thanks for your help!
PS. Tried on both iPhone 3G and iPhone 2G without succes. Both running 2.0.1. (jailbreaked via PwnageTool). As you can see i'm developing using Xcode on Leopard.
I found out my application was running in a sandbox and because of that i couldn't write files into the directory i was trying to. I used the function NSHomeDirectory() for retrieving the directory of the sandbox. At that directory i was able to write my images to.
Now, i really would like to know how i can use a sort of preview mode. Tried many things but nothing works so far.
Can you guys help me out with this one a little bit?
I'm traveling down similar paths.
Any luck on your app?
Any source code to share?
By g0tcha in forum iPhone "2G" (Rev. 1)
Last Post: 12-06-2007, 11:11 AM
By CrYzM3 in forum General
Last Post: 09-19-2007, 07:00 AM