Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-16-2011, 04:08 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 7
EJDSlayer is on a distinguished road
Default SIGABRT due to view change?

Hi all,

I'm trying to add a subview to my current view as I have done before but I think it's causing a SIGABRT. Is there anyway I can trap what is actually causing this error?

My code is as follows:

Code:
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

    // Loads the specified .xib file as designed earlier.
    if (contactEdit == nil)
    {
        ContactEdit *contactsE = [[ContactEdit alloc] init];
        contactsE.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        self.contactEdit = contactsE;
        [contactsE release];
    }
 
    [self.view addSubview:self.contactEdit.view]; 
}
The ContactEdit class is as follows:

Code:
#import <UIKit/UIKit.h>

@class EditableField;

@interface ContactEdit : UIViewController
{
    UITableView *table;
}

@property (nonatomic, retain) IBOutlet UITableView *table;

@end
And the view class I am trying to add it to is as follows:

Code:
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>

@class ContactData;
@class ContactEdit;

#define kTableViewRowHeight 66

@interface ContactsList : UIViewController
<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
{
}
The ContactList class is created, displayed and functions fine. The issue only comes when I try and add the subview to it within the AccessoryButtonTapped function.

Any help is much appreciated.

Kind Regards,
Slayer.
EJDSlayer is offline   Reply With Quote
Old 11-19-2011, 04:27 AM   #2 (permalink)
Registered Member
 
dabronx's Avatar
 
Join Date: Jun 2010
Location: Ashburn, VA
Posts: 27
dabronx is on a distinguished road
Default

Where is contactEdit declared? If you are not retaining it, then you are assigning it a value and then killing the object the value points to.

Code:
self.contactEdit = contactsE;
then you kill off contactsE

Code:
[contactsE release]
If self.contactEdit is not RETAIN'd in your .h file, you just threw away the contents that it points to.

If you don't want to retain contactEdit, you could:

Code:
self.contactEdit = [contactsE copy];

You can also turn NSZombie on (its in this forum somewhere) and it will tell you a bit more about what's wrong - most likely trying to use a variable you already killed.

Hopefully helpful.

Quote:
Originally Posted by EJDSlayer View Post
Hi all,

I'm trying to add a subview to my current view as I have done before but I think it's causing a SIGABRT. Is there anyway I can trap what is actually causing this error?

My code is as follows:

Code:
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

    // Loads the specified .xib file as designed earlier.
    if (contactEdit == nil)
    {
        ContactEdit *contactsE = [[ContactEdit alloc] init];
        contactsE.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        self.contactEdit = contactsE;
        [contactsE release];
    }
 
    [self.view addSubview:self.contactEdit.view]; 
}
The ContactEdit class is as follows:

Code:
#import <UIKit/UIKit.h>

@class EditableField;

@interface ContactEdit : UIViewController
{
    UITableView *table;
}

@property (nonatomic, retain) IBOutlet UITableView *table;

@end
And the view class I am trying to add it to is as follows:

Code:
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>

@class ContactData;
@class ContactEdit;

#define kTableViewRowHeight 66

@interface ContactsList : UIViewController
<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
{
}
The ContactList class is created, displayed and functions fine. The issue only comes when I try and add the subview to it within the AccessoryButtonTapped function.

Any help is much appreciated.

Kind Regards,
Slayer.
__________________
Vesta Software, LLC

Follow Me On Twitter!

Visit me on Facebook!

dabronx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 398
17 members and 381 guests
7twenty7, Alex-alex, Apptronics RBC, baja_yu, chiataytuday, dre, gwelmarten, ipodphone, jeroenkeij, jleannex55, matador1978, mbadegree, n00b, pbart, QuantumDoja, Retouchable, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:25 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0