发布对象,我理解正确吗?

问题描述

| 我完全是Object C的新手,但是我认为我至少在根本上正确地拥有内存管理的想法。我有这个简单的方法:
-(int)weekIdFromDate:(NSDate *)inDate {

    NSCalendar *currentCal = [NSCalendar currentCalendar];
    NSDateComponents *component = [currentCal components:NSWeekCalendarUnit fromDate:inDate];
    int week = [component week];

    //I don\'t understand why this fails,it seems correct to release these objects now that they
    // are no longer needed
    [currentCal release];
    [component release];

    return week;
}
该方法存在于我的根视图控制器中,但警告位于\“ main \”函数中。我用僵尸定位了“ BAD_ACCESS ...”的原因。如果我将这些评论发布,那么一切正常,没有任何问题。     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)