IOS warning – this block declaration is not a prototype

About warnings

We define a block without parameters, usually in the following way

one

typedefvoid (^UpdateSwichBtnBlock)();

A warning is prompted in xcode9

one

two

This block declaration 

is 

not a prototype

Insert ‘

void

'

The solutions can be as follows

one

typedefvoid (^UpdateSwichBtnBlock)(

void

);

But in this way, many third parties need to change, the scope involved is too large, it may not be suitable at present, although this is the trend

Or, if it’s only a few places, it can be used

one

two

three

four

#pragma clang diagnostic push

#pragma clang diagnostic ignored 

"-Wstrict-prototypes"

typedefvoid (^UpdateSwichBtnBlock)();

#pragma clang diagnostic pop

A complete temporary solution to all such warnings

In the setting of the project

Set to no, the warnings disappear

However, this is not a good habit. It’s just a temporary way not to prompt this type of warning

Read More: