Strange error when adding Frameworks in XCode

Discussion in 'iOS Programming' started by SergioQ, Oct 2, 2009.

  1. SergioQ macrumors newbie

    Joined:
    Jul 1, 2006
    #1
    Hello All,

    I am reading "Beginning iphone Development" and I have hit a strange and serious hurdle for me.

    In the current book, page 190, I was down to just adding the sound features on a Picker app (the slot machine game).

    Everything went as the book said it would (two build errors). I added the AudioToolbox.framework just as the book said, and compiling gave me 1499 errors. A screenshot of them is here: http://warptv.com/image/error.jpg.

    I was unable to solve this so decided to work backwards. I put in the downloaded version of the chapter from forum for the book, and it worked. I then removed the above framework and it stayed true to the book. I got two link errors. I re-attached the framework following the book step by step, and bam...hit again with 1499 errors!!!! And removing that framework doesn't make them go away.

    In fact any current chapter I have done, where I add that framework I get into the same headache I have now.

    Not saying there's an error in the book or the likes, but something is amiss. And my unfamiliararrity with this enviornment, this IDE, isn't letting me find out what's going on here.

    Can someone please help me? I need to get over this hurdle so I can go on to Chapter 8.

    Thank you,

    Sergio
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Your error image isn't loading for me. You can upload images to this forum directly.

    Anyway, there are a couple of issues with adding frameworks that can cause problems. (I don't have the book you mention so I'm not sure what it's method is.)

    One simple method to add frameworks is to drag them from one project to another. If by chance you have another existing project that works with the same framework then drag the framework from one project into the other and that should work.

    The other correct way to add frameworks and the one that the Apple people recommend is this: Open the target prefs window for your target. Go to the General tab. At the bottom is a list of Linked Libraries. Click on the + button at the bottom and then choose a library from the sheet that appears.

    Also, sometimes when Xcode adds frameworks it adds a path to the frameworks search paths settings for your target. This will usually f*** up your project, although you may not know it for a while. Generally you should remove any frameworks search paths that you didn't add yourself.

    If none of this helps just paste the top of your build transcript into a message here.
     
  3. SergioQ thread starter macrumors newbie

    Joined:
    Jul 1, 2006
    #3
    I am going to look at your suggested solution. In the meantime am uploading the image in the hopes that looking at the error might give you a better idea of what is happening.

    p.s. If anyone knows how to save the Build Results to a text file (in XCode) that would be great.


    [​IMG]
     
  4. SergioQ thread starter macrumors newbie

    Joined:
    Jul 1, 2006
    #4
    At first glance this appears to work. Will play with it more tomorrow in depth to make sure.


    May I ask where and how to do this?

    May I also ask where and how to do this?

    Not lazy, just too new to XCode.

    Thanks
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    I think that you have added the MacOS version of the CoreGraphics.framework and you need to add the iPhone version of the CoreGraphics.framework. If you haven't added the wrong version then probably you have a problem with your framework search paths or one of the other search paths so that the compiler is finding the Mac framework instead of the iPhone framework.
     
  6. SergioQ thread starter macrumors newbie

    Joined:
    Jul 1, 2006
    #6
    I did not load that framework. XCode put it there when I created the project. Which puzzles me as it was a project made for iPhone not Mac.

    In fact, everything works fine until you add that AudioTool the way the book suggested. Then it all falls to hell.

    However, since I am the first to complain about it on that books accomponying forum, I have to think that something is set weird.

    Would anyone mind helping a newbie find it?

    Thanks
     
  7. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #7
    Open Project > Edit Active Target "name of your target"

    Choose the build tab at the top.

    Choose All configurations.

    In the text box at the top type 'search' no quotes.

    All of the search paths entries should be empty. Is one not empty?

    If you have a project that works without this framework you might want to compare the window between the working project and the non-working project.
     
  8. SergioQ thread starter macrumors newbie

    Joined:
    Jul 1, 2006
    #8

    Did as you suggested, and the Framework Search Paths was NOT empty on the project that had 1499 builds.

    So I cleared it (it was clear in all the working projects) and got only one error while building, below.

    While adding the Framework you suggested won't make that one error go away, I do believe that you were right in that adding it the way I was adding it, did something very bad.

    I guess I need to proceed further into the book, and the next chapter that has me ADDING a framework library I will do your way.

    Thanks... Getting really beat up here.

    Code:
    Building target “Pickers” of project “Pickers” with configuration “Debug” — (1 error)
    	    cd "/Developer/Projects (training)/07 Pickers/Pickers"
        setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
        /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -fvisibility=hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote "/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Pickers-generated-files.hmap" "-I/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Pickers-own-target-headers.hmap" "-I/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Pickers-all-target-headers.hmap" -iquote "/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Pickers-project-headers.hmap" "-F/Developer/Projects (training)/07 Pickers/Pickers/build/Debug-iphonesimulator" "-I/Developer/Projects (training)/07 Pickers/Pickers/build/Debug-iphonesimulator/include" "-I/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/DerivedSources/i386" "-I/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/DerivedSources" -include /var/folders/NB/NBz1SQCrHYG6Ns7ODQJAc++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Pickers_Prefix-gcupwreaiumdmlbeaqhingfaeglk/Pickers_Prefix.pch -c "/Developer/Projects (training)/07 Pickers/Pickers/Classes/DatePickerViewController.m" -o "/Developer/Projects (training)/07 Pickers/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Objects-normal/i386/DatePickerViewController.o"
    i686-apple-darwin9-gcc-4.2.1: /Developer/Projects (training)/07 Pickers/Pickers/Classes/DatePickerViewController.m: No such file or directory
    i686-apple-darwin9-gcc-4.2.1: warning: '-x objective-c' after last input file has no effect
    i686-apple-darwin9-gcc-4.2.1: no input files
    		i686-apple-darwin9-gcc-4.2.1: no input files
    		i686-apple-darwin9-gcc-4.2.1: no input files
    		i686-apple-darwin9-gcc-4.2.1: no input files
    		i686-apple-darwin9-gcc-4.2.1: no input files
    Build failed (1 error)
    
     
  9. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #9
    When you add the framework the wrong way Xcode adds the path to the framework search paths. This makes the linker find ALL the wrong frameworks, which causes the multitude of errors.

    This is the remaining problem, it can't find this file:

    /Developer/Projects (training)/07 Pickers/Pickers/Classes/DatePickerViewController.m: No such file or directory

    Does that file exist?

    One other thing, that may fix this problem, is that Xcode still has some bugs related to spaces or other special characters in the path to your project. I recommend that you move your projects out of the /Developer folder. Put them somewhere in your home folder. Also, don't have spaces or parens in the path.
     
  10. CodeBlitz macrumors newbie

    Joined:
    Oct 22, 2009
    #10
    That helped...

    I found a strange value under the "Framework Search Paths" setting in the target settings. My steps to fix were.

    Groups & Files > Targets > Pickers. Right-clicked for Get Info.
    A model form loaded titled "Target "Pickers" Info." The word Picker refers to my project name.

    I clicked the Build section button at the top. Using the Search field I typed the word search. The setting results came back with eleven results two of which were bolded. One of the bolded results is called "Framework Search Paths." The value of that setting included a strange relative path with many /./././. in it. I deleted it. After this I attempted to build and received only two errors. This was clearing causing the problem. Thanks.
     

Share This Page