Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi everyone.
I wrote this code:
Objective-C
- (IBAction)getTrainingSet:(id)sender {
    [self.netOne.trainingSet initWithContentsOfFile:@"/Scrivania" encoding:NSASCIIStringEncoding error:NULL];
}

"trainingSet" is a property declared as NSString.
When I try to compile and run this code, I get the "Expression result unused" error, reported to the "error:" parameter. How do I fix this?
Thanks...
Posted

you must you the keyword "nil". The compiler distinguishes between the integer value "NULL" and the null pointer "nil".

It is a "feature" of Objective-C ;-)
 
Share this answer
 
Comments
militandri 12-Oct-14 13:34pm    
Yes I know, but even if I write nil it still doesn't work.
Try like this
C#
self.netOne.trainingSet = [[NSString alloc] initWithContentsOfFile:@"/Scrivania" encoding:NSASCIIStringEncoding error:nil];
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900