I am a newbie Objetive C developer and I am trying to fill up a vector which it is a variable property... But It doesn't working, I can not understand why or how to fix it
-(void) setUpLabels:(NSString *) _labels_path {
// Read the label list
self.label_strings.clear();
std::vector<std::string> new_values;
std::ifstream t;
t.open([_labels_path UTF8String]);
std::string line;
while (t) {
std::getline(t, line);
new_values.push_back(line);
}
self.label_strings.reserve(new_values.size());
for (int index = 0; index < new_values.size(); index++) {
self.label_strings.push_back(new_values[index]);
}
NSLog(@"size=%lu",self.label_strings.size());
t.close();
}
This is the .h file
@interface AIClassifier: Classifier
@property std::vector<std::string> label_strings;
- (id) init;
- (id) initWithParams:(NSString *)model:(NSString *) labels;
@end
The function setUpLabels
is not in the file..
All the time is printing size = 0. I tried more simple versions with the same result.