Xcode 4: 构建失败,没有问题

该应用程序在模拟器中运行良好,构建和运行。

当我连接我的设备(运行 iOS 4.3的 iPhone 3GS)并瞄准 iPhone 时,结果是“构建失败”且“没有问题”。

查看构建结果窗口,一切都是绿色的,有一个选中标记 包括构建失败通知

扩展成绩单显示没有错误。

我不能排除签名或配置错误的可能性,但它给了我这些错误,我解决了它们,现在它没有给我任何错误或问题,只是“构建失败; 没有问题”

  • 构建在哪些方面可以毫无问题地失败?
  • 有没有一种方法,我可以看到构建输出,看看我是否可以找到原因,它的失败没有问题?
  • 是否有超出问题列表的生成输出?
  • 我没有在构建窗口中看到它试图将应用程序加载到我的设备上——这个输出是否在其他地方?
52081 次浏览

The first thing I'd try is to clean everything (menu Product / Clean) and the build it again. You might have already tried it.

You'll find (and you can watch during the build) the complete build output in the Log Navigator. That's the right most icon of the small icons just below the Run and Build buttons.

The build (and debug) log files are found in the directory /Users/you/Library/Developer/XCode/DerviedData/YourProject-abcdefg/Logs/Build (and ../Debug respectively).

I don't think there's any output for the installation of your app on the device.

Same problem here when building for device. Build failed, but my log all is green checkmarks. Cleaning/deleting build folder doesn't fix it. I read elsewhere that someone solved this problem by deleting and recreating the target, but I haven't completely figured out how to do that yet in XCode 4.


My temporary solution has been to download and install XCode 3.2.6 w/iOS 4.3. I didn't realized that Apple had also released a version of XCode 3 that includes iOS 4.3, allowing you to postpone the upgrade to XCode 4. I filed a bug report with Apple about the Build Failed issue.


udpate from Apple:

When we build this project - albeit on a post-Xcode 4.0 version - we see the following in the ProcessProductPackaging step in the build log:

(null): error: CFBundleIdentifier 'com.yourcompany.Magic_Carpet' contains illegal character '_' invalid bundle identifier 'com.yourcompany.Magic_Carpet'

The ProcessProductPackaging code got an overhaul fairly recently, so we suspect it just wasn't emitting errors properly in Xcode 4.0. Take a look at the transcript of your own build, and if so, then this will likely be fixed in a future release of Xcode (we cannot comment further until a fix has been released).

I switched from an underscore to a dash and it fixed the problem.

Have you cleaned your build folder? Go to the Product menu, hold down the Option key, and select "Clean Build Folder…"

On one of the local Cocoa Heads mailing lists I was encouraged to attempt a small default sample project - something I should have done in the beginning to make sure my provisioning and signing worked. It built and ran on my device without issue, so all signs point toward a problem with my code or the project.

I'll be throwing things from the existing project into the new sample project, and if it fails in a similar way I should be able to narrow the problem down to a smaller region of interest.


I've added the main functionality of the app into a new project, and it's running fine. The only things I did differently this time was I did not set up a universal binary (iPhone only right now) and turned off all but portrait orientation. As far as I can tell everything else is the same, though if I decide to look into it further later I will diff the project files and see what else might be different.

So the solution for me was to start a new project a port all the functionality from the old project into the new project.

It could be that recreating the target, as Paul suggests in another answer, would fix it as well, but with such a simple project restarting from scratch was easy for me.

Are you using "Underscore" and "Space", etc. for Bundle identifier?

Are you using .m instead of .h in one of your imports? #import "Photo.h"

Is there a space in your Target's Product Name?

I know that in earlier versions of Xcode this was no problem, but it seems that they broke something in Xcode 4 so it doesn't work any more (I suspect it's something to do with the DerivedData path nonsense). You can add a space to the name of your app as it appears on the Launchpad of your iDevice by setting the CFBundleDisplayName key in the Info.plist to something other than ${PRODUCT_NAME}.

I had exactly the same problem when trying to compile an existing project in xcode 4, and very nearly went through the pain of recreating the project.

However, in a last ditch attempt I replaced the info.plist file with a newly created one which included the additional tags for "document types", "url types", "Exported Type UTIs" and "Imported Type UTIs"

This seemed to work and was a surprisingly simple fix for my project.

I had the same problem, and like someone else suggested it had to do with the bundle identifier. I had recently changed it, as a test, and had put an asterisk in it. I fixed that, and had to clean the target, and then it worked.

This happened to me after deleting an unused target. It seems that Xcode put a space in my remaining target's CFBundleIdentifier (com.company.etc). I had to edit Info.plist with an external text editor to remove it and then it worked fine.

I know what the problem is: In Info.plist -> Bundle Identifier: you can not use '_'. For example, com.mycompany.My_app is not valid, but com.mycompany.My-app OK.

I had this same problem. I was trying to fix it a xcode crashed. I reopened it and it worked just fine. Maybe I was lucky or something? Whatever, I don't really care what was wrong with it as long as it works now

Same thing just happened to me with a different cause.

I removed get-task-allow from my Entitlements.plist file, leaving an empty plist. Build settings still had Entitlements.plist file specified as my Entitlements file. Chose to run using my Ad-Hoc build settings on iOS device with my iPhone connected, and saw the behavior described in this bug. Adding get-task-allow back fixed it.

see: http://developer.apple.com/library/ios/#DOCUMENTATION/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html

The UTI Character Set A uniform type identifier is a Unicode string that usually contains characters in the ASCII character set. However, only a subset of the ASCII characters are permitted. You may use the Roman alphabet in upper and lower case (A–Z, a–z), the digits 0 through 9, the dot (“.”), and the hyphen (“-”). This restriction is based on DNS name restrictions, set forth in RFC 1035.

Uniform type identifiers may also contain any of the Unicode characters greater than U+007F.

Important: Any illegal character appearing in a UTI string—for example, underscore ("_"), colon (":"), or space (" ")—will cause the string to be rejected as an invalid UTI. At the API layer, no error is generated for invalid UTIs.

I was just playing with adding multiple projects inside a workspace and got this problem. I have a simple library in one of the projects and I was building and I added an iOS window based target to test it. I deleted the first target I made for this to rename it. After reading this I tried removing xcuserdata from inside the .xcodeproj package and that fixed my problem. I hope this helps someone else. Running Xcode 4.1 on OS X 10.7.1.

I had no problem with name of the bundle so suggested solutions didn't work for me. Finally I have set Don't code sign for the build, then I closed the project, then removed provisioning in organizer, then downloaded new provisioning and add it to organizer, then set them for the build. It worked.

This happened to me with my UnitTest target. Was working and then stopped. I'd forgotten i'd just deleted a .h/.m on the file system and not removed it from the project file, however XCode didn't report it.

I figured it out by running the project on the command line, which told me the error:

/usr/bin/xcodebuild -target "UnitTest"

Run this in the folder you have your project file, and replace UnitTest with your target - or just don't pass in a target to build the default target.

seems like there are many possible causes of this problem. Mine turned out to be that

My target was set to use a non-existent provisioning profile.

I set my project to use a new profile, and I deleted the old one. Didn't realize that the target had its own provisioning profile setting, which was still set to the old (now deleted) profile.

If you changed bundle identifier and cleaned project, but it also didn't work, try to empty /Users/YOUR_USERNAME/Library/Developer/Xcode/DerivedData directory.

It works for me.

I had this problem too, but the cause was a different one:

I have a workspace with one project in it. In this project I use a framework which is included by adding it's Xcode project to my project. I imported the framework's header file in my prefix header (.pch). This was stupid.

The solution was to remove the #import of the framework header file from my prefix header file and add it only where needed.

This is not a technical answer, but a "user error" answer that probably does not apply to your situation. It happened to me and my search lead me to this Q&A to no avail --- until I realized my mistake. I had a filter set in the Issue Navigator that did not match anything that was being reported as an issue. When I cleared the filter, the issues were displayed.

Notice the symptoms were the same as you were asking about and I have no idea when I set that filter (it must be inherited from the other navigation views) as I would not have needed any filtering on the short list.

I just had a similar problem. Could not find an error anywhere. Deleted all my provisioning profiles and added new ones.

Then I tried building another test app to my device and I got this error message:

Code Sign error: Certificate identity 'iPhone Developer: xxxxxx' appears more than once in the keychain. The codesign tool requires there only be one.

So I went into Keychain, found a couple of expired certificates with the same name, and deleted them, and that did the trick.

Pretty random, but perhaps if you try building another app to the device like i did, you might be lucky enough to get an error message, as i did, to help diagnose the problem.

For me, the build failed without displaying any errors in the Issue Navigator. However, in the Log Navigator, in that build session, I could see the error. In my case, the error was an undeclared constant. I imported the required header file and the problem was resolved. I am not sure, why this error did not show up in the Issue Navigator.

I tried to reproduce this behavior by deliberately changing the name of another variable. This time, the error was displayed in Issue Navigator. So, I am still unsure about why wouldn't the earlier error show up in the Issue Navigator.

Hope this helps.

After going though all these answers, I had the exact same issue, but something different solved it for me.

The Problem:

Build failed without issues after refactoring. (Renamed a class using Edit -> Refactor -> Rename).

The Dumbest Solution Ever:

Go refactor (rename) something else (-_-"). After doing that, the error was that Xcode failed to rename all appropriate files, and didn't show errors. Then, after another refactor, the errors from the previous refactor appeared.

Just to add another answer after trying ALL the above without success: I had to restart the MacBook, not only close XCode, and that worked for me. It ended up with XCode showing some errors in the Localizable.strings that it didn't show before.

Hope that helps

Go to Organizer in xcode. And in Project Tab, delete that project. Let xcode rebuild the derived data again fix my problem.

The above solutions do not work for me.

My solution is to move the project to another folder.

The build errors then just appear as normally did.

i clear all Spaces in project schemas in xcschemes and this resolve this issue. F***ing Apple :( AppCode ROCKS!

I had a similar problem to this and the fix was removing the camel case naming of the project name.

I had the same problem and I fixed it by adding a missing include used for a macro defined in the prefix file.

I have this macro defined in the prefix file:

#define ApplicationDelegate ((tdAppDelegate *)[UIApplication sharedApplication].delegate)

but in the file that I used I forgot to include the file "tdAppDelegate.h" ;)

I faced similar problem in XCode4.5 and while working on my application XCode suddenly crashed.

After searching for hours, I found out one of my file in my application got deleted when xcode crashed.

I restored the file from Trash and issue got resolved.

I found that i was missing a Framework. I used the MFMailViewController and I added a reference to

 MessageUI/MessageUI.h

but I inadvertantly forgot to add it to the project... Incase you dont know how to add a framework to a project:

Double Click on the Project Name in Project Navigator --> Select Build Phases --> Expand the Link Binary with Libraries tab You will see a + and -. Select + for adding a framework. Type in the name you are wanting to add and when you see it, click on it and click on ADD.

I was programming an Mac OS X application without codesigning. When I enabled sandboxing in the "Entitlement" section, codesigning automatically switched on and I couldn't make a new build.

In my case, the reason was that one of my Localized string had no ; in the end: So, "You’ve already passed the test" = "Тест по этому слову уже пройден" with no ; in the end brings to Build Failed with no issues.

Just tried everything in this post and nothing worked.

Then went Apple menu > Software update > spotted there was an xcode update.

I havent installed the update yet but simply keeping this window open resolves the issue (when I close the upgrade window the issue re-occurs).

I guess this must be kinda rare, but hopefully it will solve the issue for some.

In my situation ,It's my coding compile problem. but XCODE don't make the compile error remind.

If your Xcode project contains subprojects, try closing the parent project and opening the child Xcode project directly.

My subproject had an error, but it wasn't showing in the parent project's error list when I built the subproject's target. But when I opened the single Xcode project and built the same project, the error appeared.

My mistake was accidentally typing a letter in line 1 of my main.m file and accidentally saving it.

I was about to lose hope and migrate my code to a new project until I accidentally opened my main.m file in Finder. Too bad the compiler didn't see that error.

For me was a deprecation in the JSONKit Library. It was accessing to the isa property of an object which is deprecated, we must use object_setClass() instead.

Check for Spaces in the name. Not only of your target(s) name(s), but also build schemas as well. For me removing spaces did the trick.

I've been getting 'Build Failed' with no errors in the Issue navigator(only warnings). Report navigator, though, displayed errors correctly.

Xcode 6.1

My problem was leaving error in one .m file, then going to another and closing Xcode without fixing the error in the first .m file. After I opened Xcode again, the error was not showing until I went to the first .m file. Then it showed up without any interventions.

I was using one macro from the file which was not imported, after importing that file problem solved.

FOR me i checked the hidden(not listed) issues by Product -> Analyze. All the hidden bugs will be listed if Analyze fails

For me this started to happen after I added the line: "~Documents" in: Build Settings -> Header Search Paths.

After I removed it the the debugger started working again.