Search code examples
ipadfreezexcode4.3uipopover

uipopover freeze issue on Xcode 4.3.2


hello I'm just trying to make a simple uipopover from a rectbutton. in previous Xcode (4.2) i can run this without any issue, but when i try to run this code on Xcode 4.3.2 iPad simulator, its freeze/hang when i pressed the rect button. can anyone help me? here is my code

in header file :

@interface popViewViewController : UIViewController <UIPopoverControllerDelegate> {


}

-(IBAction)showPop:(id)sender;


@end

implemantation file :

#import "popViewViewController.h"
#import "infoView.h"

@interface popViewViewController ()


@end

@implementation popViewViewController

-(IBAction)showPop:(id)sender {

    infoView *infoview = [[infoView alloc] init];
    UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:infoview];
    [pop setDelegate:self];
    [pop presentPopoverFromRect:[sender bounds] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUnknown animated:YES];
    [pop setPopoverContentSize:CGSizeMake(300, 200)];


}

here is where the error show :

#import "popViewAppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([popViewAppDelegate class]));
    }
}

"thread 1 : signal SIGABRT"

thanks.


Solution

  • Clearly the problem is not in the InfoView as I expected. One question, are you using ARC? if so, try to keep the popovercontroller into a strong property. The possible explanation for this is that in ARC the popover will be automatically released when leaving the method. If you are not using ARC I dont have any other clue, sorry.