views:

58

answers:

1

Hey Guys i am getting this error "message sent to deallocated instance 0x141dafb0" its comming from a UIBarButtonItem when its beeing pressed on the application. any help would be greatly appreciated

Error:

 *** -[PeerConnection performSelector:withObject:withObject:]: message sent to deallocated instance 0x14143ff0

PeerConnection.h

#import <UIKit/UIKit.h>
#import <GameKit/GameKit.h>

@interface PeerConnection : NSObject <GKPeerPickerControllerDelegate, GKSessionDelegate> {
 UIBarButtonItem *StartConnection;
}

- (IBAction) StartConnectionAction;

@property (nonatomic, retain) IBOutlet UIBarButtonItem *StartConnection;

@end

PeerConnection.m

    #import "PeerConnection.h"


@implementation PeerConnection
@synthesize StartConnection;


- (IBAction) StartConnectionAction {
 NSLog(@"Start Connection to the other IPhones");
 [StartConnection release];
}

- (void)dealloc {
 [super dealloc];
}

@end

i have enabled Zombie and that is all its giving to me

+2  A: 

Don't release your StartConnection button until -dealloc. Releasing that bar button item in -StartConnectionAction is your problem--anything the UI tries to do with it after that will call a zombie.

Dan Ray
i did that before but it was still giving off the same error but with a different exception code now its giving me " *** -[PeerConnection performSelector:withObject:withObject:]: message sent to deallocated instance 0x14159ff0"
That's happening somewhere outside the code you've provided us. Make darn sure you're not releasing anything before the viewController that's going to use it deallocs.
Dan Ray