views:

4338

answers:

13

This is a new iPhone project, only 1 target (different from this question)

On build we get:

Failed to launch simulated application: Unknown error.

The google again gives us nothing, lots of people have encountered this and there are lots of crazy ideas to try "oh clean the build", "clear the cache", "twiddle this flag" and none of them work and work consistently. We can reproduce this on two different machines with SDK 2.2.1 and 3.0 beta. Not the install on the machines since other iphone projects work just fine so we believe it has something to do with the config of this particular project but after combing through the config twice we can't spot the problem.

Vanna, I'd like to buy a clue for $200 please.

  • Tried: XCode menu->Clear cache
  • Tried: clean all targets
  • Tried: rm -rf ~/Library/Application\ Support/iPhone\ Simulator
+4  A: 

If other projects work fine; start a new one and copy the files. Combing through configs just won't do it (since XCode has, well, thousands of config possibilities).

You can send me a check with the $200.

P.S: When you actually do start a new project, do it step by step. Run it after each change. Maybe you will find your problem. It might be a ton of work, but it might also help the other thousands of lost souls who have an 'Unkown Error'.

MiRAGe
Yeah, with so many settings in a project file that can get messed up, this is sometimes the best course of action. It's annoying but should only take 15 minutes or so. Normally faster than diagnosing any other way and once you're done, you can compare settings to try and find where they differ.
Matt Gallagher
+2  A: 

I sometimes see this problem and it is fixed by rebooting the maching. I suspect the internal state of the simulator gets screwed. Doesn't sound like your problem though.

I agree with MiRAGe; if this persists, start a new project and import your source.

Roger Nolan
Yes, I just had this problem and a reboot fixed it. I'll add that I also deleted ~/Library/Application Support/iPhone Simulator by dragging it to the trash after rebooting.
sbwoodside
Great, now I have this problem again and deleting that and rebooting doesn't help at all. Apple sucks.
sbwoodside
A: 

Another thing to try if you are desperate is to change the 'Product Name' setting. This worked for me once when everything else didn't.

Gabe
A: 

Changing the product name worked for me. I tried several different alternatives and all of them worked fine. It was the "magic product name" I used at the onset that failed every time I went back to it. YMMV.

fbrereto
+2  A: 

This happened to me once and I think I saw in a blog to simply quit and restart Xcode. Miraculously, it worked for me. I doubt this is the end all solutions to all problems like these though, but if you haven't yet closed Xcode, it's worth a try.

Jorge Israel Peña
+1 Caught this answer on Google. Please try it before you do anything drastic! Sometimes Xcode just gets in a flap and needs to be restarted.
Chris Burt-Brown
+2  A: 
quano
A: 

I had the same problem because I had changed the BundleName and some other values but not changed the PRODUCT_NAME. I had problems finding where PRODUCT_NAME is defined: Get Info on the target, Build-tab and it is down the list somewhere.

I changed PRODUCT_NAME to match the bundle name, restarted Xcode and it worked.

Fred

fredw
A: 

Thanks ...Did have the same problem or worse. My app wasn't loading in the simulator, alternatively sometimes the build failed. Now realized it's pretty logical.

When you create a new project and info.plist get associated with the project. Each time you add a modify/add the target another plist is generated with the new name.

But the original association with the info.plist is still around and there's a conflict. So remove that association from the current target or better still remove from project and trash the info.plist. Just make sure in the target settings(do getInfo) the correct info.plist is mentioned.

Note the name for product/target should not have spaces. If you really want it change the bundle display name.

Now the only reason why xcode should be closed is to ensure the project file has registered all changes.

trips
+1  A: 

I got this problem when I added the .plist to my target (Info.plist -> Get Info -> Targets -> Target Memberships). It went away when I unchecked it again.

I see that that's separate from the Targets -> -> Get Info -> Build -> Packaging -> "Info.plist file" -> my.plist that trips mentioned, but I still don't really understand what's going on, and definitely don't understand why we get such an unhelpful error message.

arya
Wow, worked for me! I've been having this problem for ages.
Amorya
A: 

I had this problem recently and the fix was ridiculously simple. I remembered that I had been editing the target settings and under the "Properties" tab in the "Executable" field there was a space after the value which was ${EXECUTABLE_NAME}. Yes, a single space. It was impossible to see unless you highlight the field. I figured this out because I had edited that field seeing if I could add a command line option that way. I guess when I cut the additional option back out, I missed a space. So while this is the only possible cause of this problem, it's worth checking out.

Mike
+1  A: 

I've had this twice for the same reason: adding a folder called Resources to the project. This is a naming conflict with something (though there is nothing called "Resources" in the application bundle by default). It might be that mysterious naming conflicts are a common cause of this problem.

To fix I renamed the folder to something else ("Assets"), manually deleted the entire build folder (clean didn't work) and quit the simulator.

Chris M
A: 

Had same problem. None of the answers above worked for me. Then i remember i had just added the icon to the Resources folder before the problem started. Moved icon to Other Sources folder and it worked. Weird!

Victor Flores