I have a class (called class A) that creates an instance of another class (called class B) . in class A I call a function fro class B that opens the camera to read a QR code . once the QR code is detected the camera feed is dismissed using this line :
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] dismissModalViewControllerAnimated:YES];
now in class A I want to use this event handler to do other things (mainly use the nsstring that I just got from the QR code) so I wanted to use the -(void)dismissModalViewControllerAnimated:(BOOL)animated
method for that. But I Noticed the following
-if I have the method with an empty body the reader is not dismissed
-if I have the method with anything in it , the application calls indefinitely the function and the application crashes and/or XCode freezes and crashes eventually
is there any alternative to what I am doing? I ideally I would like to do something like that :
-(void)dismissModalViewControllerAnimated:(BOOL)animated{
[self dismissModalViewControllerAnimated: YES];
DisplayLabel.text=output;
}
Thanks!
Your example, being that it calls itself, would lead to recursion with no exit condition, unless you meant to pass the message to super
instead of self
.