Handles correctly errors when parsing ints.

If the its are invalid, now it propagates the error
Adds missing define needed for iOS