drew..
drew..

Reputation: 3604

Confused xcode? warning with suggested format fix, then next compile want to switch it back?

This is kinda bizarre for such a stalwart devtool like Xcode. But i have an NSLog as follows:

NSLog(@"getting request via remote notif.. with state: %d", application.applicationState);

and compiler warnings to change it to:

NSLog(@"getting request via remote notif.. with state: %ld", application.applicationState);

And on the very next compile, i get the exact same warnings but in reversed!

how odd..anyone know the real issue?

Upvotes: 0

Views: 79

Answers (1)

Claus Jørgensen
Claus Jørgensen

Reputation: 26336

To support logging in a 64 bit environment, you should always use %ld and then cast your integer to long ie.

NSLog(@"blablabla with state: %ld", (long)application.applicationState);

See String Format Specifiers for more info.

Upvotes: 2

Related Questions