11
votes

By using of Xcode 5 and auto-reference counting is enabled.

In a Non NavigationController based application i have take a UIButton and the IBAction and IBOutlet are properly defined and connected. But before the IBAction for TouchUpInside event called by Button taped the App gives "[SecondPage performSelector:withObject:withObject:]: message sent to deallocated instance 0x6cb7970". SecondPage is view-controller on which this UIButton exists.

Basically I want to open a new view-controller's view on this UIButton tapped and i will do this by Custom Segue

3

3 Answers

27
votes

Hmm strange it sounds like ARC is autoreleasing your secondView controller before your selector is being called.

Try defining your secondView as a property of the first (if you're adding it as a subview) with a property type of strong.

That's all I can recommend without seeing your code.

1
votes

I was getting same problem and solved with what Matt Rees suggested.

Just declair your secondViewController in firstViewController.h and made its instance there. Like, secondViewController *secondView;

0
votes

I was getting same problem and solved with what error thrown.

With more details, I was reallocating caller object (SecondPage in this case) on logout/login, but re-using some other viewcontrollers, so re-used viewcontroller have previous instance of caller object that I reallocated.

Well, solved it now!