On Oct 15, 2011, at 20:20 , Roland King wrote:
> -(void)addView:(UIView *)view forElement:(id)element
> {
> CFDictionarySetValue( viewToElementMap, (__bridge id)view, (__bridge
> id)element );
> }
>
> gives me
>
> error: incompatible types casting 'UIView *__strong' to 'id' with a __bridge
> cast [4]
Look in 3.2.4 of the ARC document:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects.operands.casts
'UIView*' is a retainable pointer type, so you must bridge it to a
non-retainable pointer type -- in this case, you want 'const void *' because
that's the type of the parameter you're passing:
> CFDictionarySetValue( viewToElementMap, (__bridge const void *)view,
> (__bridge const void *)element );
That compiles without error for me. Note that both of your casts were wrong.
The error message on the 3rd parameter didn't appear until the error on the 2nd
parameter was corrected.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]