如果是Mac 10.6 或 iOS 4.0 之前的平台可以利用 http://code.google.com/p/plblocks/ 這個project得以支援Block語法。
=======
Installation & Use
Plausible Blocks is composed of two pieces:
- Plausible Blocks SDK: Supplies custom compilers for use in Xcode.
- PLBlocks Runtime: A runtime library required by all applications making use of Plausible Blocks.
To install the SDK, simply install the included “Plausible Blocks SDK” package. Once installed, an additional “GCC 4.2 (Plausible Blocks)” compiler will be available for selection in your Xcode project and targets. To build with the new compiler, simply select in either your project’s build settings, or on a per-target basis:
In addition to the SDK, you’ll need to include the PLBlocks runtime framework in your application. It is provided as an embeddable framework for Mac OS X, and as a static framework for iPhone applications.
To include in your project:
- Copy the Mac OS X or iPhone PLBlocks.framework to your project directory
- Within Xcode, select “Add -> Existing frameworks” and add the copied PLBlocks.framework to your project.
- Ensure that PLBlocks.framework has been added to your targets “Link Binary With Libraries” section.
- (Mac OS X Only) Add a new “Copy Files” build phase to copy PLBlocks.framework to your application’s “Framework” directory.
- Set the project, or a specific target, to use the “GCC 4.2 (Plausible Blocks)” compiler.