0

我在头文件中有属性声明

@property (nonatomic,copy)CHECK_MATERIAL_HEADER  *checkmaterial;

像这样的实现是 .m 文件

NSMutableDictionary *headerdictionary = [[NSMutableDictionary alloc] init];

    for (int i=0; i<self.delegate.replenishAddedmaterials.count; i++)
    {
        NSString *key = [self.delegate.replenishAddedmaterials.allKeys objectAtIndex:i];
        NSArray *materialarray = [self.delegate.replenishAddedmaterials objectForKey:key];

        //material array will hold
        // 1. material objects at index 0
        // 2. vendor objects at index 1
        // 3. Purchase organization objects at index 2

        MATERIAL_ITEM *material = [materialarray objectAtIndex:0];

        self.checkmaterial =[[CHECK_MATERIAL_HEADER alloc] init];

        [self.checkmaterial setMATERIAL_NO:[material getMATERIAL_NO]];
        [self.checkmaterial setMATERIAL_DESC:[material getMAT_DESC]];
        [self.checkmaterial setOPEN_PO:[NSNumber numberWithInt:0]];
        [self.checkmaterial setOPEN_PR:[NSNumber numberWithInt:0]];

        //add the header objects into header array
        [headerdictionary setObject:[NSArray array] forKey:self.checkmaterial];
}

我的对象像这样崩溃,

-[CHECK_MATERIAL_HEADER retain]: message sent to deallocated instance 0x13f92890

请给我一些解决方案。项目是在 ARC 中实现的。

4

0 回答 0