0

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.

redribbon
  • 41
  • 1
  • 10
  • can you post the code for the infoview? how have you added the popViewViewController? I dont see anything incorrect in the part you posted. – Angel G. Olloqui May 02 '12 at 11:54
  • actually this is just a trial code because in my actual project it just behave the same(freeze). thats why i create this simple new projects and i don't know why it keeps freeze. i already try to remove the whole Xcode and reinstall but still doesn't work. its so frustrating knowing that nothing is wrong with my code. perhaps i will try to completely reinstall my osx lion later. ps. i have two iMac and i use the code on 4.2 Xcode on my other iMac and it runs just fine without any freeze. ow and my infoView contain no code just the standard created by default. – redribbon May 03 '12 at 06:57
  • Well, I think that something is wrong in your code, but not in this part. Reinstalling or starting from scracth will not help I guess. I would like to see the infoView controller, because it seems to me that the problem is there. – Angel G. Olloqui May 03 '12 at 08:28
  • below is the infoView controller. – redribbon May 03 '12 at 17:07

2 Answers2

0

if its help here is the infoView controller:

infoView.h :

#import <UIKit/UIKit.h>

@interface infoView : UIViewController

@end

infoView.m :

#import "infoView.h"

@interface infoView ()

@end

@implementation infoView

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
redribbon
  • 41
  • 1
  • 10
0

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.

Angel G. Olloqui
  • 8,045
  • 3
  • 33
  • 31
  • sorry for asking, but I'm really noob in this. what is ARC anyway? – redribbon May 04 '12 at 07:02
  • You should google it to have the whole information, but it is Automatic Reference Counting, that is to say, automatic memory management. Have you tried the solution that I propose with the ivar? – Angel G. Olloqui May 04 '12 at 08:13
  • well, the ARC really seems to be the issue. darn, I've been wasting my 5days just to find this out. I'm glad now. thanks again angel for being so helpful. – redribbon May 05 '12 at 19:35