Search code examples
iosobjective-cnsobject

No Known Class Method for Selector 'valueWithCGPoint'


I imported this PRTween library to my project.

Here are the source codes:

PRTween.h

PRTween.m

But it cant compile and gives me a lot of error

I really have no idea why is this happening because I have no experience with Objective C before.

enter image description here enter image description here


Solution

  • When the compiler warns you that:

    No visible @interface for X

    Chances are you're just forgetting to import the header file that contains this class.

    In your case, you will want to import both Foundation.h and CoreGraphics.h:

     #import <Foundation/Foundation.h>
     #import <CoreGraphics/CoreGraphics.h>
    

    OR

    You might be import looping. Say you have fileA.h and fileB.h, if fileA.h imports fileB.h and fileB.h imports fileA.h, then the compiler will get stuck in an import loop, usually causing it to flag up completely unrelated errors about missing @interfaces.

    Have a careful look back through your headers and make sure you're not import looping. If you are, you probably just want to move one of the file imports from the .h to the .m or completely re-think your dependancy structure.