Thank you so much. I can't check it till I get home from work at 7; but when I find out what the issue was I'll post back here so hopefully no one else has to go through this; I'm sure its going to be something fantastically silly.
Turns out the issue is that the Image Picker can not be displayed immediately in the viewDidLoad method of the view controller; but it can if you set a delay of .1 seconds...weird
You are cursed. It is now not working for me. It always had worked for me in the past....
Edit: Got it and sending now.
For others like me (may also be cursed) can you post the relevant code on the thread? I'm running into the same exact issue as the OP. I tried setting a NSTimer as well but alas, no luck.
FYI, I'm experiencing this behavior on SDK versions 2.0-3.0.
he sent it to you through email... any chance you can post your code up here.. or even the whole project
im running into the same error you were
thanks!
-OG
A couple of others have hit similar problems (me included), it appears you have a solution it would be nice to share it with others on this site.
What I don't understand is: (and please don't bother to answer, just an expression of sheer unadulterated frustration...)
a) Why its so damned complicated
b) Why it doesn't work
c) Why theres so little documentation
d) Why they had to invent another language
e) Why theres no apparent error return when it is clear that the display function may not work
f) Why I am being so stupid as to waste yet more of my life with a half baked solution when frankly other companies have done it already and better
g) Why I can't open two projects at once
h) Why I can't see windows on my mac that I've minimised
i) Why there are so many keys missing from this keyboard - what was wrong with going to the start and end of lines without waiting hours for the character by character cursor movement
when you implement it thorugh a UIView and not a UIView controller its laggy and a pain in the butt... also apple denies it for being against the "contract"... i had this happen in my app... what i ended up doing was adding a subview (uiView) to my UIViewController and in that UIView it had my normal MainView app but when i pressed a button it set a variable, removed my UIView (my subview) and went back to the UIViewController, in the UIViewController it has an NSTimer and when that variable is set the NSTimer detects it then adds the camera, once the photo is taken it adds back my subview and saves the photo to a UIView
its confusing but not against apples contract
p.s. remember when adding a subview to a UIViewController you cannot say
[self addSubview:myUiView];
you have to say
[self.view addSubview:myUiView];
if ( (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourc eTypeCamera]))
{
windowText.text = @"Camera not available";
}
else
{
// now start the camera
windowText.text = @"Started picker";
If I check 'self' wen I ask it to animate the cameraImgPicker the UIViewController member is full of nulls - including the UIView *_view member(looks totally uninitialised to me), in contrast a working program from the web seems to show this member has something in it. I can't work out how the difference occurs.
Do you see a problem with this code?
I call this in a uiviewcontroller, and as soon as i call it the screen goes all blnak and white. The code is in uiimakepickercontroller documents, so i don't see why it shouldn't work
i) Why there are so many keys missing from this keyboard - what was wrong with going to the start and end of lines without waiting hours for the character by character cursor movement
Ctrl+A, Ctrl+E
I haven't found all the hotkeys yet, but the equivalent of HOME/END is there, and it's emacs-like.
//--------------------------Handles Picking--------------------------
-(void)openPicker
{
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker;
picker = [[UIImagePickerController alloc]init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.allowsImageEditing = YES;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
}
}
-(void)imagePickerController:(UIImagePickerController *) picker
didFinishPickingImage:(UIImage *)imag
editingInfo:(NSDictionary *)editingInfo
{
someImage = imag;
[someImage retain];
//Call some method here that you want to call after they take the picture
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerController:(UIImagePickerController *) picker
{
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
-(UIImage*)getTheImage
{
return image;
}
-(void)setTheImage:(UIImage*)img
{
image = [img retain];
}
Good luck!
Hi Multi Hands,
I just wanted to draw some more attention to your solution. I have been trying to sort out the use of the UIImagePickerController within my iPhone for about 6 months. I had read probably around 50 posts on the memory issues around this.
I read in lots of places about the app crashing after 5 pictures. However, my app would sometimes work and sometimes crash immediately (switching off the iphone and then back on often helped since it freed up memory).
I found your solution last night and tried it and it worked! I can now carry on with an app that I had stopped developing so thank you VERY much!
I think the fact you increase the referencing count by 1 (using the retain method) is what has fixed my code.
Turns out the issue is that the Image Picker can not be displayed immediately in the viewDidLoad method of the view controller; but it can if you set a delay of .1 seconds...weird
Thanks tKilmer!
Hey,
I've come across the same problem, I'm having to use this method as I'm using layers with a opengl layer, I get the blue bar, which I imagine is the tool bar for the image picker at the top of the screen, and saw that you wrote after the delay of 0.1 it loaded fine?
Can you help give any sort of indication as to what was used for this delay?
You can just use the performSelectorWithDelay method to call methods on a time delay. There are other ways too.
Yeh thats what I thought, and was trying to implement before giving in and writing you a reply, which by the way thanks for getting back to me so quickly; but it was ignoring this method, I'm not asking for the answer, because otherwise i'll never learn but if regards to how you first started talking about it in a blank project, where abouts and on what method did you invoke the delay..?
Sorry for sounding so desperate, but litterally been starring at this for a week solid..
I'm not sure how you have everything set up. But basically instead of calling the picker right in your viewDidLoad; make some other method whose only job is it present the picker; call it ShowMyPicker or something. Now, in your viewDidLoad do a performSelectorWithDelay where ShowMyPicker is the selector on whatever delay you want.