mRs- / HexColors

HexColors is an extension for UIColor and NSColor to support for creating colors from a hex strings
MIT License
457 stars 102 forks source link

Cannot find interface declaration for 'NSColor'; did you mean 'NSCoder'? #13

Closed Gob-Lin closed 9 years ago

Gob-Lin commented 9 years ago

I am getting this error on compile while using HexColors and TSMessages along with about 20 more errors, all related to HXColor.

mRs- commented 9 years ago

ok, that's strange. can you hand in more information for your project?

Gob-Lin commented 9 years ago

Hi Marius,

problem solved, it was my fault (error in PrefixHeader.pch).

Cheers,

Paolo

Il giorno 10/nov/2014, alle ore 10:04, Marius Landwehr notifications@github.com ha scritto:

ok, that's strange. can you hand in more information for your project?

— Reply to this email directly or view it on GitHub.

rjpalermo1 commented 9 years ago

Getting same error with TSMessage - removed from my project and just added the implementation files here and multiple errors all related to NSCOLOR.

New project, iOS8 - I have no PrefixHeader.pch but adding one does not solve errors. Any ideas?

SoundBlaster commented 9 years ago

Minimum PCH content

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import "HexColor.h"
#endif
Gob-Lin commented 9 years ago

Problem resurfaced with iOS8 project. Tried adding PrefixHeader.pch with both previous content and the minimum suggested by SoundBlaster to no avail. Can't use TSMessages anymore :-(

mRs- commented 9 years ago

iOS 8 only projects are default working with modules. If you use modules the PrefixHeader.pch is not necessary an more. You have to link the .pch in your build target.

aporat commented 9 years ago

after upgrading to xcode 6.3, I'm experiencing a similar issue in a Swift iOS project. the project will not compile.

I resolved it by importing <UIKit/UIKit.h> before #import "HexColor.h" inside the objc to swift bridging header:

//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

#import <UIKit/UIKit.h>
#import "HexColor.h"
...
mRs- commented 9 years ago

got the same problem here. the main reason is that TARGET_IPHONE_SIMULATOR and TARGET_OS_IPHONE is linked in UIKit and we are depending on that for the OSX Support. Maybe not the best idea here ;)

Any suggestion to fix this?

mRs- commented 9 years ago

current solution in the example project: https://github.com/mRs-/HexColors/blob/develop/Classes/HexColor.h#L15

aporat commented 9 years ago

would including TargetConditionals.h in #import "HexColor.h" work for osx as well? http://stackoverflow.com/questions/24664649/conditional-compiling-of-objective-c-in-a-swift-project

mRs- commented 9 years ago

seems to work fine!

mRs- commented 9 years ago

@aporat does it work for you now without importing UIKit in the bridging header?

aporat commented 9 years ago

yeah, that solution works fine with swift projects (atleast for ios)