iPhone – Different Objective-C type conditions expressed the lack of actors?

I received this error:

The conditional expression of different Objective-C types’struct NSNull *’and’struct NSNMutableArray *’lack a coercion

On this line of code:

((tempArray!= nil)? tempArray: [NSNull null])

Why?

The two legs of the conditional expression should have the same data type. Convert the first one to id to avoid warnings.

Why do you need NSNull instead of nil?

I received this error:

The condition expresses different Objective-C types’struct NSNull *’and’struct NSNMutableArray *’ Missing a cast

On this line of code:

((tempArray!= nil)? tempArray: [NSNull null])

Why?

The two legs of the conditional expression should have the same data type. Convert the first one to id to avoid warnings.

Why do you need NSNull instead of nil?

Leave a Comment

Your email address will not be published.