我有一个View对象在我的方法中突然变为零。查看对象突然变为零 - xcode
我没有使用ARC
没有线程参与
请告诉我发生的事情是一日一次我称之为1stmethod方法的一切工作正常,并于livescoreSettings参考被保留。
下一页时,我打电话2ndmethod方法也livescoreSettings裁判保留,但由当时的委托方法被激活变量丢失的参考..不知道为什么...
@interface XY {
LiveScoreSettingsView * livescoreSettings; // initialisation in .h file inside
}
@end
@implementation
// 1st method
- (void)1stmethod:(id) callingClass username:(NSString*)username {
livescoreSettings=callingClass; // retain count increases to 1
isLivescoresSettingsView = YES;
//.... some code where the above livescoreSettings variables are not used ... //
}
// 2nd method
- (void)2ndmethod:(id) callingClass username:(NSString*)username matchid:(NSString *)matchid eventType:(NSString *) eventType add:(NSString *) add {
livescoreSettings=callingClass;
isLivescoresSettingsView = YES;
addEventToList = YES;
//.... some code where the above livescoreSettings variables are not used ... //
}
// delegate method thats activated when the response comes
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq {
// the block where the data is sent to a particular view to reload table
else if(isLivescoresSettingsView== YES || addEventToList == YES) {
isLivescoresSettingsView=NO;
addEventToList = NO;
//.... some code where the above livescoreSettings variables are not used ... //
if(success)
NSLog(@"No Errors with retain count = %d ", [livescoreSettings retainCount]);
else
NSLog(@"Error Error Error!!!");
[livescoreSettings.tableView reloadData];
// when **2ndmethod** is called there's no memory reference to livescoreSettings, tableView delegate methods are not called which is obvious. But not sure why the retain count is reducing abruptly.
}
}
@end
是否使用ARC? – trojanfoe
也是'livescoreSettings'的一个实例变量? – trojanfoe
没有ARC ... livescoreSettings不是一个实例变量..它在.h文件中被声明 –