How can I retrieve a textfields text and store it as an integer 32 in core data?

I'm trying to get the textfields text, convert it to an int, and store it in a core data integer 32 attribute. I'm getting an error in the process:

Implicit conversion of 'int' to 'NSNumber' disallowed  with arc

Here is What I've tried:

// trying to convert
int intLength = [self.length.text intValue];

// trying to set the current garden attribute to the converted int
self.currentGarden.length = intLength;

How can I fix this?


NSNumber is an object and is not the same as int. Try creating a NSNumber using the constructor:

self.currentGarden.length = [NSNumber numberWithInt:intLength];

Need Your Help

SSRS 2008: Passing Parameters to linked report

sql-server sql-server-2008 reporting-services

I have a report table with all the combinations of dimensions as generated by the parameters set by the user. Each row contains 1 combination and a link to another report with charts. How do I pass...

What are the best cursor (mouse) tracking applications for web sites?

javascript statistics mouse cursor tracking

What are the best cursor (mouse) tracking Javascript applications for web sites? To be stored in a database...