Don’t miss these cool stuff in D10

Tim Cook talked about Apple

See the video here: Tim Cook on Steve Jobs , Apple TV and Facebook: The D10 highlights

Mary Meeker release Internet trends of 2012

See this 98 pages report:

KPCB Internet Trends – 2012

An excellent handbook: “Facebook for business” from Looops.net

Looops.net released an excellent facebook handbook for business. This is such a good handbook, I’d like to share this in my blog.

The handbook was written in Japanese. Hope you can read it.

Although it was written in September 2011, but it still has huge value for anyone who want to apply Facebook to their business.

Meanwhile, my colleague Yazawa Osamu and his company Socialand is also pioneer on helping business user to expand their business on Facebook.

handbook on Slidershare

WWDC2012 eve @Tokyo

WWDC 2012 will be open within 3 weeks, I’d like to have a WWDC2012 eve party at my company Voyage Group. iOS developers who can go WWDC from Tokyo, if you have time on Friday, June 1st evening, please come!

How to register

Please visit: ATND and register yourself.

Fee

2000Yen/person

includes:
* Free beer/Free softdrink
* Free Pizza/Sushi

Date and time

June 1st, 2012 7pm~10pm

Place

AJITO of Voyage Group
〒150-0045 8F 8-16 Shinsen-cho Shibuya-ku, Tokyo

Topics

  • Making new friends
  • Exchanging hotel/tour/visit information, etc.

OK, let’s meet up on June 1st, at 7:00pm

An object in Cocoa, but do not use `*`?

Block

via NedraI via CC License

A funny question

Here is the funny question:

Is there any object in Cocoa/Objective-C that is a object but you do not use * to indicate it?

Now, think a few seconds before you read on: is there any such kind of objects?

NO? are you sure about that?

The Answer

The answer is YES! Yeah, there is a such kind of object in Cocoa/Objective-C.

It is the Block object!

Why?

Apple brought Block, a much more common name is Closure. As you can see from the wiki page, it is a non-standard extention to C/C++/Objective-C 2.0

Because it is an extension not only to Objective-C, but also to C/C++, so it has some special treatment.

Because Block has ^

To indicate a piece of code as a Block(or a Closure), it DOES need something like a pointer, but not a normal pointer. It act as a function pointer, but much more powerful.

So Apple introduced ^ as a replacement of * to Block.

In Objective-C ^ == *

As we can see, ^ is also a pointer, so why do we need another * to pointer to a Block?

Sample code

Use it as a method argument

typedef void (^MyBlock)(void);
- (void)doSomethingWith:(MyBlock)block;

Use it as a property

typedef void (^YourBlock)(void);
@property (nonatomic, copy) YourBlock block;

Use it as a function argument

typedef void (^HisBlock)(void);
void myfunction(HisBlock block);

Note that, none of above is using * to indicate a block, because the typedef has already indicated it is an object.


Of course, don’t forget to follow me @TonnyXu and Facebook