Problem with xCode please help!

Discussion in 'Mac Programming' started by Soulstorm, Feb 20, 2006.

  1. macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #1
    I am programming on carbon framework with xcode 2.2. I am a total beginner in this.

    And I want to include an image in a simple window. No buttons, no other stuff

    So, I make a resource file from this image uusing graphic converter. I go to my project, and I add the .rsrc file in the "Resources" folder.

    I open my .nib file with Interface Builder and I include the image in the main window. I click "Test interface" from the menu of interface builder and everything seems normal.

    But when I compile my entire program with XCode, the image does not appear in the window!!

    I went to the package contents of my newly built application and saw my .rsrc file in there, only it had 0kbytes size!

    What can I do? Am I doing something wrong?

    EDIT: Repaired perimissions, updated prebindings, rotated logs and still the same problem...
    EDIT2: I tested the same method into another machine and I had the same problem. Is it a bug, or I am making something wrong?
     
  2. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #2
    Just an idea...

    Your .rsrc file could be losing its resource fork when it is copied as part of the build process. That would explain its size (0) and the fact that it isn't displayed (.rsrc files have all their content in the resource fork).

    You could:
    1. Use a different image format that stores the image data in the data fork (png, jpeg)--whatever will work with xcode & interface builder.
    2. Find the build step that copies your .rsrc into the package and make sure it preserves resouce forks. I've never poked around in xcode's build process, so I have no help to offer you here.
     
  3. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #3
    every time that I save a file with an .rsrc extension, it is a PICT resource file. How can I make a resource file that contains .png? Can you show me a program that will help me?

    EDIT: Maybe I should rephrase it:
    How do I add images into my carbon application? What type must me those images, how do I create them, and what steps do I need to follow in Interface builder?
     
  4. macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #4
    Don't save it as a resource file, simple as that. Save/export it as a PNG.
     
  5. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #5
    Excuse my ignorance, but as you can see I am a total noob, and my book ("Mac OS X programming by Dan Parks Sydow") only explains what I must do with resources, and doesn't say anything for any other file types.

    I tried what you said too. After that, what do i need to do?

    I go to my project, and I with right-click, I add the .png file to my project, in the "resources" folder. But when I open Interface builder, it doesn't show me the image I want to use. How do I use this .png file?

    Can you explain me exactly what must I do? And why the expected result is shown in the interface builder when I test my interface, but not in the final program????
     
  6. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #6
    OK now I'm really worried. I did the same thing with a resource file that came directly from apple's example files. It didn't work. It showed the expected result in the Interface Builder, but the final program was missing the resource file...

    Help. :mad:
     
  7. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #7
    Hmm... I was working with a .nib for a cocoa app, where I could just drag-and-drop a .png file into the images tab of image builder. But this doesn't seem to work the same way for Carbon .nib files. I can't see how to add a .png to a carbon .nib. According to Interface Builder help:
    This doesn't seem to be the whole story though. I added a .png (and a PICT) to the one-and-only target in a test carbon project. It does not show up in the images tab. Sorry, I don't see how this is supposed to work...
     
  8. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #8
    at least have you managed to import a resource file to the carbon application? Can it happen, or am I not the only one that has the problem?
     
  9. macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #9
    Is the resource in the Resources folder in the main Xcode window?

    If it isn't try to drag it there.
     

    Attached Files:

  10. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #10
    Yes it is. I think I already mentioned it in my first post. :)
     
  11. macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #11
    That you did. Sorry about that. :eek:

    What happens if you don't add it in Xcode but only choose File -> Import -> Import Resource File in Interface Builder.
     
  12. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #12
    Absolutely nothing. It prompts me a dialog which says to import a resource. I choose the resource I have made. But in the next dialog, all I see is an empty box, containing nothing that can be imported. This thing is getting weirder and weirder...

    What method are you following to import pictures in carbon with interface builder?
     
  13. macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #13
    I've only used Cocoa. I'm just throwing out some ideas just in case I happen to suggest something you haven't tried.
     
  14. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #14
    Well I guess that's the price for me to learn C++... Everyone here uses Cocoa and can't help me. In Cocoa i think, there arent such problems, as there are many image formats you can import, such as plain png and jpg files.
     
  15. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #15
    Sorry for the double post. I figured out what's happening. A guy at apple discussion forums told me what I must do. Damn! I would have never figured this out.

    Apparently, many people have this question, since this system is much complicated.

    Look at this page:

    http://www.meandmark.com/xcodetips.html

    in there is says:

     

Share This Page