Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton tapped getting [SecondPage performSelector:withObject:withObject:]: message sent to deallocated instance

Tags:

xcode

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

like image 365
indu Avatar asked Jan 04 '12 07:01

indu


2 Answers

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.

like image 131
Matt Rees Avatar answered Nov 03 '22 00:11

Matt Rees


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;

like image 45
Jay Pandya Avatar answered Nov 02 '22 23:11

Jay Pandya