OdieO
OdieO

Reputation: 7004

Logging enum value

I had to upgrade my deployment target and now I'm getting a few errors when logging enum values.

 NSLog(@"Warning: unexpected unit :%d", unit);

Produces the error:

Format specifies for type 'int' but the argument has type 'NSCalendarUnit' (aka 'enum NSCalendarUnit')

The suggested fix of using %lu and then %u produces similar errors.

Upvotes: 1

Views: 1616

Answers (1)

OdieO
OdieO

Reputation: 7004

Just had to cast the enum value to (int):

NSLog(@"Warning: unexpected unit :%d", (int)unit);

Upvotes: 3

Related Questions