Problem while including custom framework in Project

Discussion in 'Mac Programming' started by Monaj, Mar 14, 2011.

  1. Monaj, Mar 14, 2011
    Last edited: Mar 14, 2011

    Monaj macrumors regular

    Joined:
    May 24, 2009
    #1
    Hi all,

    I am trying to learn how to create custom frameworks and use them in a project in cocoa, so I began with a simple custom framework named - SimpleFramework.

    It contains one class with only one class method:


    Code:
    // class name: SimpleClass, role: Public
     
    + (void)displayMessage{
        NSLog(@"Hello World");
    }
    I also set its Installation Directory path to - @executable_path/../Frameworks then compiled it.

    I included it in another project using following steps-

    1. Dragged SimpleFramework.framework into Frameworks folder in project. Also selected Copy items to destination group's folder and Add To Targets check box.

    2. Created a New Copy Files Build Phase. Selected its destination as Frameworks.

    3. Dragged SimpleFramework.framework into it.

    Problem is, when I am trying to import SimpleClass.h in SimpleTestAppDelegate class, it is giving this error message on compilation-

    SimpleClass.h: No such file or directory.

    Can anyone suggest me if I am doing anything wrong?

    Thanks,

    Monaj
     
  2. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #2
    I think you forgot to make SimpleClass.h a public header file. Select the file in your original framework in the target group. The file pane above your code editor will then have a new option to make the file public, private or <third option>.
     
  3. Monaj, Mar 14, 2011
    Last edited: Mar 14, 2011

    Monaj thread starter macrumors regular

    Joined:
    May 24, 2009
    #3
    @MrFusion .. thnx for your reply :)

    I have set its role as public, but still it is not working :(

    I have also uploaded the code and it can be found here- http://dl.dropbox.com/u/9999259/SimpleTest.zip
     
  4. Monaj thread starter macrumors regular

    Joined:
    May 24, 2009
    #4
    Solution found!

    I was missing this line:

    #import "SimpleFramework/SimpleClass.h" :rolleyes:
     

Share This Page