Closed ghost closed 12 years ago
Maybe you can come up with a better way to do that. I am only doing this typedef because I need DTColor to be UIColor on iOS and NSColor on Mac.
Maybe there's another order of imports and typedef that fixes this warning?
Hi, I'm not sure, maybe separate the API by using this?
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#endif
But this will split all related code and probably not a good idea.
Or add another head file to contain all the forward decl, like DTCoreTextForwardDecl.h and add it to the .pch file? Maybe just don't bother with this warning, seems not a big deal.
All Objective-C compilers as far as I know all support the @compatability_alias
directive, used like @compatibility_alias DTColor UIColor
. A bit more robust than a #define
, more compatible than a subclass, safer than casting to id
, and more language-safe than a typedef
. It's all up to you, though.
EDIT: The 4.4 compiler also seems to crack down some on casts for string formats; at DTCSSListStyle.m:246, 0x%x
should be %p
and in NSString+HTML.m:689 %C
should be %d
, according to this.
please test if the two fixes I pushed are fixing the issue.
Warnings fixed! Zero warnings in XCode 4.4 DP2 now!
Hooray! Thanks for your help!
Hi there,
I'm using XCode4.4DP2. Anyway the warnings below won't show up in XCode4.3.1.
/Users/zhaojianyin2012/Dev/DTCoreText/Core/Source/NSScanner+HTML.h:11:1: Redefinition of forward class 'DTColor' of a typedef name of an object type is ignored
/Users/zhaojianyin2012/Dev/DTCoreText/Core/Source/DTHTMLElement.h:13:1: Redefinition of forward class 'DTColor' of a typedef name of an object type is ignored
/Users/zhaojianyin2012/Dev/DTCoreText/Core/Source/NSScanner+HTML.h:11:1: Redefinition of forward class 'DTColor' of a typedef name of an object type is ignored
/Users/zhaojianyin2012/Dev/DTCoreText/Core/Source/NSString+CSS.h:9:1: Redefinition of forward class 'DTColor' of a typedef name of an object type is ignored