MikeQ
MikeQ

Reputation: 1817

Can't build app for iPhone simulator

I'm unable to build a very simple program when building for the iPhone simulator. It compiles fine for the device however!

An example code that the compiler doesn't like:

@protocol Invokable
- (id) invoke: (id)arg with:(id)data;
@end

@interface Worker : NSThread
{
  NSAutoreleasePool* memoryPool;  
}

- (void) invoke:(id)target selector:(SEL<Invokable>)selector arg:(id)arg data:(id)data;

//........    

@end

The problem is with the use of 'SEL' - the compiler complains "Qualified type is not a valid object" on every use.

I'm running xcode 3.2.1 on Snow Leopard. I'm really confused about this, because I've made absolutely no changes to my build configurations.

Upvotes: 0

Views: 256

Answers (1)

Grant Paul
Grant Paul

Reputation: 5902

The answer here is non-obvious, but the compiler is correct. The type SEL is actually just a typedef'd char*, and not an Objective-C object.

Because of that, and the fact that protocols only apply to Objective-C objects, you can't specify a protocol on a SEL type.

Upvotes: 2

Related Questions