getting EXC_BAD_ACCESS in Accessing Object in SubView
Maybe a very basic problem, but i don't get it ...
I've written my own class for having Data as an Object in my iPhone app. The class is of Type NSObject. The Class has several NSString propertys and also three objects of other classes.
@interface vcardItem : NSObject {
vCardNitem *PersonName;
NSString *Phone;
NSString *PhotoURL;
vCardTELitem *PhoneData;
NSString *URL;
NSString *eMail;
vCardADRItem *Address;
NSString *Company;
NSString *Role;
int initialised;
}
@property (nonatomic, retain) vCardNitem *PersonName;
@property (nonatomic, retain) NSString *Phone;
@property (nonatomic, retain) NSString *PhotoURL;
@property (nonatomic, retain) vCardTELitem *PhoneData;
@property (nonatomic, retain) NSString *URL;
@property (nonatomic, retain) NSString *eMail;
@property (nonatomic, retain) vCardADRItem *Address;
@property (nonatomic, retain) NSString *Company;
@property (nonatomic, retain) NSString *Role;
@property int initialised;
-(id)initEmpty;
-(id)initWithPayload:(NSString *)payload;
-(void)sendToAddressBook;
-(void)debugVCard;
-(NSString *)getFirstName;
@end
I'm creating an object of vcardItem in a function call within my viewcontroller. The Data is filled and accessible. The function initWithPayload is called and all propertys are set.
Then i open another view for showing Details and call the function setVCard with my vcardItem Object (which is still completeley accessible):
VCardViewController *aVCardViewController = [[VCardViewController alloc] init];
[self presentModalViewController:aVCardViewController animated:YES];
[aVCardViewController setVC开发者_Python百科ard:aVCard];
within the VCardViewController then, only the NSString propertys are accesible. As soon as i stry to access propertys of VCardNItem, vCardADRitem or vCardTELitem, i get an EXC_BAD_ACCESS Error.
Looks like the Objects within the vcardItem Object are not available !?
I've set the NSZombie... thing, my vcardItem Object is still living (No "Zombie"), but i cannot access the data.
any Idea? I'm a little bit stucked here....
Code Review did the job, after building in Xcode 4 against iOS 5 all is fine!
精彩评论