1

我构建程序读取文本文件,但是当我调试时,它运行正常,但是当我归档程序时,它显示错误`

"Bad received type 'NSMutableArray'"

所以我无法归档我的程序。这是我的代码:

NSString* fileContents =[NSString stringWithContentsOfFile:path
                                                              encoding:NSUTF8StringEncoding error:nil];

            // first, separate by new line
            temptextString =[fileContents componentsSeparatedByCharactersInSet:
                              [NSCharacterSet newlineCharacterSet]];

            allLinedStrings = [temptextString mutableCopy];
            NSLog(@"Line array%@",allLinedStrings);
            writeArray= [[NSMutableArray alloc] init];
            tempIndex = [[NSMutableArray alloc] init];

            for(NSInteger i =0 ;i < [allLinedStrings count] ; i++)
            {
                if([allLinedStrings[i] isEqualToString:@"[LANGUAGE]"])
                {
                    [tempIndex addObject:[NSString stringWithFormat:@"%ld",i]];
                }
                else if([allLinedStrings[i] isEqualToString:@"[AP]"])
                {
                    [tempIndex addObject:[NSString stringWithFormat:@"%ld",i]];
                }
                else if([allLinedStrings[i] isEqualToString:@"[FTP]"])
                {
                    [tempIndex addObject:[NSString stringWithFormat:@"%ld",i]];
                }
                else if([allLinedStrings[i] isEqualToString:@"[Wi-Fi Setting]"])
                {
                    [tempIndex addObject:[NSString stringWithFormat:@"%ld",i]];
                }
                else if([allLinedStrings[i] isEqualToString:@"[MISC]"])
                {
                    [tempIndex addObject:[NSString stringWithFormat:@"%ld",i]];
                }
            }
            NSLog(@"Temp Index %@",tempIndex);

我不知道为什么会这样。请帮我解决这个问题。提前致谢

4

0 回答 0