开发者

What is error in code of view did load so it crashed progrme?

开发者 https://www.devze.com 2023-04-07 21:22 出处:网络
I am using this code for view did load.. - (void)viewDidLoad { myPicker.hidden=TRUE; NSArray * shopping=[NSArray arrayWithObjects:@\"Lie in bed\",

I am using this code for view did load..

- (void)viewDidLoad {
myPicker.hidden=TRUE;
NSArray * shopping=[NSArray arrayWithObjects:@"Lie in bed",
                    @"Shower",
                    @"Brush Teeth",
                    @"Eat",
                    @"Make Lunch",
                    @"Dressed",
                    @"Make up",
    开发者_如何学编程                @"Hair",
                    @"Prepare Childern",
                    @"Other",nil];

for(int i=0;i<61;i++)
{
    if (array_time ==nil) {
        array_time=[[NSMutableArray alloc] init];

    }
    NSString *str=[NSString stringWithFormat:@"%i Min",i];
    [array_time addObject:[NSString stringWithFormat:@"%@",str]];
    [str release]; 
}
for (int i=0; i<61; i++) {
    NSLog(@"%@",[array_time objectAtIndex:i]);
}

if(array_from==nil)
{
    array_from=[[NSMutableArray alloc] init];
}
[array_from addObject:shopping];
[super viewDidLoad];

}

after that i have coded for table view. I have checked by applying break point all over but i was terminate after view did load. On console it is not giving any error. So what is mistake in this code or any where?

Thanks in advance..


you don't really need to release this string:

str

  NSString *str=[NSString stringWithFormat:@"%i Min",i];
    [array_time addObject:[NSString stringWithFormat:@"%@",str]];
    [str release]; 

you didn't allocate it

0

精彩评论

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

关注公众号