I have two methods. From the first method I am sending an array to the second method. In my first method [array count] value is 2. But in the seconf method the value is 1. But it should be the same in both method. I know its a silly mistake. But I dont understand exactly where I have done the mistake.
First method:
-(void)uploadOverlayManually: (NSMutableArray *)path{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"Array count #1: %d",[path count]);
for (int i =0; i < [path count]; i++) {
imagePath = [path objectAtIndex:i];
NSString *infoPath = [[imagePath stringByDeletingPathExtension] stringByAppendingPathExtension:@"info"];
NSData *infoData = [[NSMutableData alloc] initWithContentsOfFile:infoPath];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:infoData];
MediaInformation *currentInfo = [unarchiver decodeObjectForKey:@"info"];
[unarchiver finishDecoding];
UIImage *baseImage = [UIImage imageWithContentsOfFile:imagePath];
NSData *data = [root addImageOverlay:baseImage withInfo:currentInfo andPath:imagePath];
[data writeToFile:imagePath atomically:YES];
fileUpload = [[NSMutableArray alloc] init];
[fileUpload addObject:imagePath];
}
[self upload:fileUpload];
}
Second method:
-(void)upload:(NSArray*)filePaths{
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:root]; //root
}
NSLog(@"Array count #2: %d",[filePaths count]);
}