【问题标题】:Memory issue when parsing解析时的内存问题
【发布时间】:2013-01-15 12:29:44
【问题描述】:

下面的 xmlparser 代码显示内存警告,我暂时无法修复它任何线索请帮助我

if  ([elementName isEqualToString:@"page_details"])
    {
        IstructPageDetails *objIstructPageDetails = [[IstructPageDetails alloc] initwithIstructPageDetails:attributeDict];
        [m_objmuteArrOutput addObject:objIstructPageDetails];
        [objIstructPageDetails release];

    }

Incorrect decrement of the reference count of an object that is not owned at this point by the caller

【问题讨论】:

  • 该代码对我来说看起来不错(假设m_objmuteArrOutputNSMutableArray 当然,顾名思义)。您确定是它的 that 行导致了警告消息吗?

标签: iphone ios objective-c ipad memory-management


【解决方案1】:

initwithIstructPageDetails 应该是 initWithIstructPageDetails:helps,因为分析器会查看 cocoa 命名约定

由于代码看起来不错,这是我眼中唯一的可能性

【讨论】:

  • 嗯,很有趣。公约不是规定它以init 开头,那么为什么with/With 位很重要?
  • 我在这里假设,但我认为它确实用驼峰法来分隔单词。 initwith = 1 个字,initWith = 2 个字
  • 是的,你可能是对的。事实上,我看不出还有什么可能的解释。
  • 它解决了 Daij 的问题,非常感谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-10-13
  • 2016-06-18
  • 1970-01-01
  • 2021-09-05
  • 1970-01-01
  • 1970-01-01
  • 2013-02-28
相关资源
最近更新 更多