views:

3911

answers:

12

I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.

I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of them, but I haven't had any luck on what I hope to be the last of my problems.

When running my program in the simulator, I now get

dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit Referenced from: /Developer/iGameLib/iGameLib/build/Debug-iphonesimulator/iGameLib.app/iGameLib Reason: image not found

Now, I discovered the UIKit has moved to

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0sdk/ System/Library/FrameWorks/UIKit

and I have updated my target and project settings to point to that new framework location, but still when I build it, no luck.

I have also tried clearing out the simulator's applications and settings, still no luck.

The referencing .app is cleared when I run the "clean" menuitem, I have confirmed this, so clearly something in my project settings are still pointing to use the old UIKit location.

Where should I be looking?

I've gone as far as I can to help myself but I'm afraid I'm at a loss here. I don't see it under the target settings, or the project settings, or the plist, or any of the other files within my project.

+1  A: 

I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.

My Experience: Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopped building for whatever mysterious reason, and no amount of cleaning, googling or SO-ing provided me any answers. So I simply created a FRESH, NEW project and filled the source-code from my corrupt project into that of the new project. The new project used the SAME source, libraries, resources, settings, mind you -- and yet it built with no problems. It took about 20-25 minutes to make the transfer but considering that I had spent several HOURS trying to address a bug that would not reveal itself in the corrupt project, the time was well worth it.

So, I'd suggest doing what I did: Maybe try creating a fresh project and transfer your old source and resources over.

Good Luck

RexOnRoids
Using either an SCM system or Xcode's built-in Snapshots, if you hit such a circumstance you can roll back to previous versions of the project file, or even diff the broken project against the working one to see what changed. There are plenty of tools to try before recreating your project as a last resort.
cdespinosa
+2  A: 
  1. Check your target settings
    Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")

  2. Make sure you've chosen the 3.0 sdk as your base SDK

  3. Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK install

BTW, you shouldn't have to re-add sdk frameworks, as the paths are relative to the current SDK

Just trying to be helpful… not sure I can debug from here :)

Andrew Pouliot
So where do you go to change the 3.0 sdk as your base sdk? I'm thinking that may be the problem somehow. If it is as simple as changing the build target to be "Simulator - 3.0 | Debug" then I've already done it. Is there another setting I'm missing for the iPhone base SDK location?
Project > Edit Project Settings > General > Base SDK. Make sure that your particular target (Project > Edit Target Settings > Build > Base SDK) is not overriding the Project settings that are otherwise shared by all targets.
cdespinosa
+3  A: 

OK, SO I HAVE THE ANSWER!!!

Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.

Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it were a directory. It looks like an actual file in finder, but it is one of those package directories.

Now, I couldn't get textedit to allow me to edit it, but you can go into nano, so like I did

sudo nano project.pbxproj which is under my .xcodeproj file/folder/package/whatever.

In this file, you need to find where the SDKROOT is set. Chances are there are a few places it is referenced, but you're looking for SDKROOT = iphoneos2.2.1 or something similar. Change ALL OF THESE (there are a few) to SDKROOT = iphoneos3.0

Now, you're half way there. do ctrl x and save the file. Next you're going to do ls and find out what the .pbxuser file is. Mine is myname.pbxuser. run the same command of

sudo nano myname.pbxuser

In this file, there are a HUGE number of references to the 2.1 iphone sdk directory. Do a search/replace of iPhoneSimulatorOLDVERSION.sdk, in my case it was iPhoneSimulator2.1.sdk and change the 2.1 to 3.0. Be very careful with this though, I wouldn't want to know what happens when you mess this file up.

Save it and open xcode. CLEAN the project and build and run. Presto!

Zach's solution is the correct answer. I must say, I'm surprised that newer responses that simply say create a new project have more up votes.
pr1001
You shouldn't need to do this (in fact, there should NOT be "huge numbers" of SDK-specific paths in your project). The only thing you should need to do is Project > Edit Project Settings > General and pick the new SDK from there. If there are other SDK-specific paths in your project, did you drag frameworks into your project directly from the Finder instead of choosing them with the Add Existing Frameworks sheet? If so, check your "Framework Search Paths" in your target and delete SDK-specific paths that might be there.
cdespinosa
A: 

this is the ugliest hack for what Apple should fix in the first place. i mean for crying out loud, when will Apple get any of their development tools right?!?!?

AlvinfromDiaspar
A: 

I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). The app ran once in the simulator after removing the environment variables but never again after that.

Quitting Xcode, the Simulator, restarting Xcode and doing a complete clean of the target (including it's dependencies off course) brought me back to a good state.

starblanket
A: 

Same for me, just closed Xcode, the simulator and restarted both and all ran fine. No messing around in the terminal or other scary stuff.

Conor
+1  A: 

I just deleted the UIKit.framework from the 'Frameworks' folder, right-clicked and added it back again. Clean build, and no problem..

CapsicumDreams
I ran into the same issue, and this is also how I fixed it.xcode was trying to find the Framework in the wrong directory, so re-adding it gave xcode the proper path.
Freewalker
A: 

Same problem when launching my application without debugging. In my experience the produced binary does not seem to be the culprit.

I created an app from the xcode wizard which does launch OK in the simulator (let's call it testApp, my application being called myApp), I tried to figure out where is the difference with my app.

otool -L myApp : gives correct (relative paths) to the frameworks, same as testApp

ps -E : DYLD_ROOT_PATH, DYLD_FALLBACK_FRAMEWORK_PATH, DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH environment variables needed by ld to locate the framework are OK for myApp compared to the values of these variables when testApp is launched

I suspect that the problem lies somewhere in the communicartion between XCode and the simulator once the app is launched ... altough I can't find what's wrong ...

The solution that worked (at least for me) have certainly some big side effects but here it is : quit xcode browse the content of the package myApp.xcodeproj unlock .model1v3 and .pbxuser for modification (the lock in the information panel (cmd-I on the file)) delete these two files start xcode and retry to launch your application from there

+6  A: 

I was getting the same error

dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit

The solution on my case was simply quit Xcode and try again.

vfn
This worked for me too.
Reed Morse
Awesome, never even thought of that. But it worked!
Jarin Udom
Worked! Why did Apple hire Microsoft to make the new version of xCode?
MattDiPasquale
A: 

This will sound simple, but it took me a while before I tried it...

RESTART XCODE!

That fixed this problem for me.

Yeah...
A: 

LOL

RESTART REALLY WORKS!!!!

Humberto
A: 

Quitting xcode and restarting worked for me too

Designer023