开发者

Program receives SIGABRT when setting an ivar

开发者 https://www.devze.com 2023-03-30 17:13 出处:网络
[[self numSidesBox] setName: @\"numSidesBox\"]; This line of code receives the SIGABRT signal and i don\'t know why. numSidesBox is an instance of my subclass of UITextField. I have an NSString ivar
[[self numSidesBox] setName: @"numSidesBox"];

This line of code receives the SIGABRT signal and i don't know why. numSidesBox is an instance of my subclass of UITextField. I have an NSString ivar that uses the

@property (nonatomic, retain) NSString *name;

way of 开发者_运维知识库creating setters/getters. I have no idea what's causing this problem.


Why not try:

self.numSidesBox.name=@"numSidesbox"

This assumes you have the following in your numSidesBox header:

@property (nonatomic, retain) NSString*name;

and in your .m:

@synthesize name;

This is just a general idea to get you started and point you in the right direction; you might prefer something other than retain and will also need your numSidesBox object similarly synthesized in the current .h/.m to use dot notation on it.

Additionally, just because numSidesBox has an ivar, does not mean it actually exists in memory. Before you can use it, you have to at some point initialize it with alloc and init or a custom or dedicated initializer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号