2

This code:

[UIView animateWithDuration:0.25f animations:^() {
 self.view.alpha = 1.0f;
}];

is generating this compile time error:

Incompatible block pointer types initializing 'void (^)()', expected 'void (^)(void)'

What gives -- this has worked previously (and in fact compiles in other project just fine -- (I just checked). Is there a compiler/project setting that I've overlooked?

Base SDK is 4.2, deployment target is 4.2

1 Answer 1

7

Try declaring it as [UIView animateWithDuration:0.25f animations:^{ self.view.alpha = 1.0f; }];

The () is optional with no params, and may be confusing the parser. Which compiler are you using? I'd recommend LLVM, 1.6 I think is the latest version in XCode.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks -- changed to the LLVM compiler and it compiles (and runs)
And removing the () and using gcc works just fine too. Thanks again.
I'd still say use LLVM whenever possible (always)
Thanks I had an unrelated blocks issue and changing the compiler to LLVM fixed this. +1
I changed to Apple LLVM compiler 3.1 (default) now works fine +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.