Xcode 4 Preview 4 displays "Build Succeeded" but with errors - iphone

Xcode 4 Preview 4 displays "Build Succeeded", as show the image below there are 5 erros. Actually there are more than 5 errors, but it seems that Xcode doesn't build anymore. It happened when i built the project in xcode 3 while the xcode 4 was open with the same project. Anyone have an idea to overcome this bug and reestablish the Xcode??
I tried to restart the Xcode, restart the mac. I don't know how to clean up the build. The "clean all" option in Product menu is unable.
Thanks in advance.

Follow these steps:
Edit your PCH file
Save it again.
Clean and build
No 4th step.
Hope it helps!

Try going into your Build directory and simply deleting everything.
For Xcode 3, the build directory is usually located inside your main project folder. For xcode 4, as discussed in this question, can be found, by default, in ~/Library/Developer/Xcode/DerivedData.
Also, be aware that you won't be able to clean a target if it's running inside the simulator (though it seems like that doesn't apply in this case.)

I just got this error today and want to explain what I did in case anyone else encounters it.
Xcode would display errors but the build would be successful and run in Simulator. I created a new project from scratch and the same thing happened. I'd insert random lines like "saedrw34" and it would highlight it with the red exclamation point. But the code would still build and run.
Check the autosave settings:
Xcode-->Preferences-->General: Auto-save --> Set to Always.
I remembered that prior to my problems I had changed it to "Never." I didn't realize Xcode, when you hit Run, compiles the latest saved version on your hard drive, not the current version you see on the screen. So basically, it was building a different version than the one with errors.
May be different from your situation but thought I'd just pass it along..

For me the following worked:
Got to the "File Inspector" and uncheck the targets under "Target Membership"
Build the project (maybe also clean build)
Check the unchecked targets under "Target Membership"
Build the project

Related

Xcode 10 archive build compile failure

Building on devices and simulator works fine in Xcode 10 but an archive build in Xcode 10 hangs up at the same spot each time (cpu maxes out too), at the very end of "Compile Sources" but never goes to the next build phase. Of course, when I quit the build I get an uncategorized SwiftCodeGeneration warning (also using legacy build system also fails, also same happens before and after updating to swift 4.2). Anyone else running into this?
Another note, not using cocoapods, tried removing all my embedded frameworks and still had the same issue.
remove the armv7 from supported architecture works for me
I found some answers to this problem.
I adjusted the level of optimization, this allowed me to get past the "compile sources" build phase (in particular "fastest and smallest" and "optimize for speed").
the compiling then got stuck on the "copy bundle resources" phase. making sure my project folder names matched the actual folder names and making sure all my resources were linked properly by deleting the reference to a few and re-entering them into the project I was able to successfully compile. Again this was a project that worked a couple days ago on Xcode 9. Hope this helps someone, cheers.

Xcode 4.2. gets stuck "Attaching to myapp" when running

In xcode 4.2, sometimes when you're going to run your ios proj on simulator, the status windows says "Attaching to myapp", and just gets stuck there... until you cancel.
Now, this has been asked before:
XCode 4 hangs at "Attaching to (app name)"
and surprisingly, besides the accepted answer on that thread, there are at least 10 other possible solutions others have been adding, all for the same issue, people says one of them worked while the others didn't...
please note, this is not a sequence of steps. each one is a possible solution:
1- restart xcode and/or restart simulator (reset content and settings) and/or restart computer.
2- click on project name in project navigator. in build settings tab, go to packaging and make sure that "Product Name" is the same that the one xcode says simulator is attaching to when running. if they are different, it will fail.
3- go to your projectname.xcodeproj folder. inside there delete anything named with your userid. when you reopen xcode those files will be recreated and it should work…
4- Manually delete the build directory for your project.
5- Go to organizer window. select Projects, select your app in the left hand side and then delete over "Derived Data"
6- Check Launch option is set to "Automatically" in Product->Edit Scheme, "Run" scheme.
7- In Project->"Edit Schemes"->Run. Change the Debugger from GDB to None (this doesn't make sense to me..).
8- Kill the process gdb-i386-apple-darwin from Activity Monitor. this is assuming gdb is not responding.
9- In "Product"->Edit Scheme. in Run, click yourappname.app, choose other, navigate to your .app in your project. now run.
10- Check that you don't have two different Info.plist in your project. if you do, remove the bad one.
In my case, none of them do the job. My project builds succesfully, everything seems fine, .plist, bundle identifier, name, etc.. and still can't pass the "attaching" part. i don't understand the reason of this, so any suggestions to fix it and possibly understand the problem i'll really appreciate it.
New projects were failing to launch in the simulator, getting stuck on the attach step.
This seems to be after Xcode 4.3 was installed, but I can't recall the last new project I created.
This is what worked for me, the clue coming from this thread...
Project->"Edit Schemes"->Run. Change the Debugger from LLDB to GDB
Another computer with the same version of Xcode works fine. Maybe my LLDB is corrupt?
Did you recently upgrade to OSX 10.7.2? I started having the same problem after I upgraded. I noticed that the Simulator always get stuck if I'm connected to a Wi-Fi network that forces Captive Portal authentication. This happens with other apps as well (Chrome, Safari). I'm not really sure why this happens, but I did read that 10.7.2 has issues with Captive Portal authentication.
Anyway, in my case, I repaired disk permission from Disk Utility and rebooted my machine. This seems to resolve the issue.
Just rebooting the computer worked for me.
Tried all the solutions but none applied to my case. XCode 4.2, OS X 10.6.8
Found that the Info.plist bundle identifier had been accidentally deleted when adding a custom app icon. Adding that back fixed the problem.
Anyway that's my fix, hope it helps someone.
Also before figuring out that, found I could start the simulator from another app and then use the app icon on the simulator for the app that would not attach, and start it up that way.
seems like there seem to be a lot of things causing this, but one thing that worked for me was simply cleaning out the build folder by pressing Cmd+Option+Shift+K or alternately if you select the Product dropdown in the toolbar and hold the Option button you should see the "Clean Build Folder" option appear
I also tried all solutions in that topic but all failed. But finally it was found out that what was went wrong.
What made this issue occurred is that some settings in Target->Build Settings was got modified by me for including C headers. And after I added all C headers and make it built. This issue occurred.
It might be only works on the situation I described before.
I just created an empty project and check all items in Target->Build Settings between the attaching-stuck app and the empty one. It was found that some items in the attaching-stuck one was different from the empty one.
So I deleted it and make it attached successfully.
It seems different in my case and also solved in a different way. If you got stuck every time after drop some files or folders into your project with the 'Create folder references for any added folders' way, this will be the solution.
Click the project node(the root node) on Xcode's project navigator and select target node. It's under the 'TARGETS'. Then click the 'Build Phases' tab. There are 4 sections of some list and you can click the triangle to expand the list.
You need to concentrate on the 'Compile Sources' and 'Copy Bundle Resources' section. Code files like .m must be placed on the 'Compile Sources' section and are compiled automatically. Resource files like .jpg must be placed on the 'Copy Bundle Resources' section and are copied into the project's package.
So, if the dropped files and folders are not in the 'Copy Bundle Resources' list, just drag it form the project navigator and drop onto the list. That will solve the problem.
If it doesn't work, delete all the referenced files and folders, click '+' button on the resource (or compile) section and click 'Add other...' button. Then you can include files and folders as the 'Create folder references for any added folders' way. I think the 'drag and drop' works well after the '+ button' way is done once.
In addition, 'Resource' may not allowed for folder name.
I experienced the 'stuck' problem every time when I attach files and folders as reference on Xcode 4.2 ~ 4.3.3. Reinstalling mac was a useless effort for me.
I have noted in Lion that when the iOS sim locks up or hangs the app,
that if I go to a shell, and do ps -ef |grep SDK, I will
see many, many processes running associated with the simulator.
I tried to kill off these processes but they rapidly respawn
and the only solution then is to reboot. Also, in the ps output,
you will also see instances of your app running as well.
So the Simulator issue is caused by previously running processes
that appear to block the correct running of the latest one.
I guess Apple will have a fix for this eventually, as it is quite onerous.
Rebooting works for me, too, but this shouldn't be necessary. I'd recommend filing a bug at bugreport.apple.com. You can duplicate the one I created - the more it's duplicated, the more likely Apple is to fix the problem.
I tried all of the solutions above but without luck ...
When I search for simular problem here :
Xcode error: failed to launch [directory] -- invalid host string: 'localhost'
I found it fixed my problem!
Hope this helps those who are still searching for a clue .
Upgrading to XCode 4.6.2 resolved this issue for me
Even if the app is not attaching after cleaning the project, changing the app name, restart the by resetting the simulator, and if you are using LLDB compiler, it is because the LLDB compiler is not able to connect to the local debug server in order to solve this, take a look at this
Why does the LLDB Debugger constantly fail to attach?
This really solves your problem!

refactor function error - "is not part of the build phase of any targets in the Xcode 3 projects in this workspace and so can't be refactored"

Trying to rename a function's name via the refactor->rename button in a categoriy's .h file in XCode 4.1 I'm getting this error: (error and body)
UINavigationController+ZG.h is not part of the build phase of any targets in the Xcode 3 projects in this workspace and so can’t be refactored.
Add the file to the build phase of a target in an Xcode 3 project in this workspace, or make a selection in another file.
Not sure what it wants and why it's saying something about xcode 3 when i don't have any xcode 3 projects or anything like that.
I had this issue today on a project which don't use workspace at all.
I couldn't get why Xcode behave wired. Auto complete worked, but return some really unrelevant results as my FAMILY NAME (?!) for a class I was working on.
I found it to be a bug in Xcode 4.1 under OS X 10.7.1 along side with other issues i had.
When I reopen my project, the message was gone, refactoring worked as expected and auto-completing worked as well.
September 2013 Update:
It seems that this bug is happening also on Xcode 5 & 10.8.5.
Restarting Xcode did not fix this for me (although it does normally fix a lot of things). I also didn't like the idea of File >> Save As Workspace. As the workspace should already be in my .xcodeproj file, so I didn't want another one. I found another solution that fixed it for me: Window >> Organiser and then Delete Derived Data for my project. Found it mentioned in this other question.
I was able to get past this error by choosing File >> Save As Workspace.
For me personally it was a combination of things.
Deleted derived data from Organizer > projects. (Didn't work after this step)
Restarted Xcode. (Worked after this step)
I have just run into this issue as well. I found that running:
Product->Clean
Fixed the problem, and I can now use refractor again.
I replaced some dead values in project.xcworkspace (Show Package Contents on your Xcode project file) and the problem went away
Have you ever deleted .xcworkspace in Finder? Although the file will be auto-generated by Xcode again, yet its content will be changed. I think that causes your problem.
I saw a post recommends to delete .xcworkspace for the purpose of enhancing build speed. Well, mind the catch.

XCode 4 problem, always showing target view when stops at a break point

I just upgraded to XCode 4.0.2 and ran into a strange issue. Every time when the app stops at a breakpoint, XCode shows the target view instead of the .m file. When I manually click the file and show it, and click step, then the IDE switches to the target view again. This makes debugging virtually impossible. THis only happens to my own project. Sample projects work fine. Please help, it drives me nuts and I can not find where did I get the settings wrong.
P.S, this project worked fine on XCode 3, after upgrading to Xcode 4 I had problems with my targets. After wrestling a while with the schemes it finally builds and runs fine, but I can not do debugging when making changes because of this. I am not sure if I messed up some settings during the time to change the scheme and target settings.
Thanks
Ray
Ok, found the problem, but still not having the real solution. The situation is that the project was originally in one directory called WorldClock, after having problems when installed XCode 4, I copied the folder to another folder called WorldClockNew, and started in this folder. However somehow the build directory is still pointing to the old directory. After deleting the Build folder under WorldClock, this problem went away. However I still can not find where in the XCode settings to correct the Build path..

Xcode 4 hangs at "Attaching to (app name)"

I just upgraded to Xcode 4 and for some reason my app won't run in the simulator or iOS device. It was working perfectly in Xcode 3, but all of a sudden now when I press run the program stops at "Attaching to...". There doesn't seem to be any other info to help with this problem either.
For summary you can try following things to tackle the issue:
Restart the simulator.
Make sure that you haven't included the Info.plist file in your Building Phases -> Copy Bundle Resources.
Resources folder added to the project as a folder reference (the blue folder icon). That caused the trouble, after adding the folder as a group the problem went away.
Fixed it!! Hopefully this helps some people avoid a very frustrating couple hours. I solved this by:
Clicking on the project name in the left pane (at the very top). This will bring up a new menu to the right, something like the project/ target editors in XCode 3.
Click on Build Settings up at the top.
Under Packaging make sure your product name is the same for every build, and equal to whatever it says it's attaching to. Eg if XCode is Hanging at "Attaching to myLCBO" but your product name is "LCBO Finder" then it won't build. That was exactly my problem because I renamed my app half way through development.
Here was our fix:
In Project > Edit Schemes > Run.
Change the Debugger from GDB to None (directly above the green circle in the image above).
A tip I found at the Apple Developer Forums:
Go into your ProjectName.xcodeproj/
directory and delete anything named
with your userid. Re-open the
project in xcode and all that will get
recreated and it should work. At least
it did for me.
Another tip is to manually delete the build directory.
Yet another tip is to navigate to the Organizer (Shift ⇧ Command ⌘ 2 in xcode 4), select Projects, select you application in the left hand side and then the Delete...-button to the right of Derived Data.
And never forget the universally useful tip: restart your computer and try again.
Good luck!
Solution provided didn't fix the problem in my case.
In order to solve it (XCode 4 only), I had to go to Product -> Edit Scheme. Then select the "Run " scheme, and marked "Automatically" which wasn't enabled.
Hope it helps someone.
For everyone still trying to resolve this after everything you tried from above, try reseting the iPhone Simulator.
Simulator > Device > Erase All Content and Settings...
This will erase all apps from simulator, but now you can finally use simulator!
Also: make sure that you haven't included the Info.plst file in your Building Phases -> Copy Bundle Resources. If so, remove it from that list! I small mistake which could happen, but something that messes things up quite nasty :S
Restarting simulator works for me :)
One more possible solution: I had my Resources folder added to the project as a folder reference (the blue folder icon). That caused the trouble, after adding the folder as a group the problem went away.
I really find the answer for me :)
for me,
project setting -> your target -> build phases -> validate setting -> perform
and now the problem is gone.
:)
I hope someone it help
I solved this problem how:
1) iOS Simulator->Reset Contents and Settings...
2) Sure project name, scheme name and target name is identical. "AppName" and "Appname" is not true. Must be "AppName" and "AppName", or "Appname" and "Appname".
3) Restart XCode and Quit Simulator.
Project name at Build Settings->Product Name.
Scheme name at Product->Manage Schemes. Click on current scheme once for rename.
Target name at Column of Project with Targets. Click once on current target for rename.
Good luck =)
Like Rob said, but also check the "identifier" should read by default "com.yourcompany.YourAppName" I had changed the "yourcompany" by mistake and this caused the same issue noted above.
This also seemed to happen to me when the info.plist file was in the copy build phase. It appears that sometimes Xcode will warn you about this, and other times it won't. Very strange. But if you are experiencing this issue, make sure that info.plist is NOT in your copy build phase.
My problem was also a folder named "resources" on the root source folder. Looks like it conflicts with some internal build naming.
Renaming the folder to "res" solved the problem for me.
I tried everything in this page, and the "new" solution that worked for me was to go into the simulator, and "Reset Content and Settings" in the iOS simulator main menu.
This solution is not technical but it worked for me.
When Attaching to Process shows up in xcode and it hangs for a while, just quite the iOS simulator and re-launch the app by pressing Command + R.
It will launch the app without any issues :)
I tried everything and nothing worked. I have an old project from XCode 3. I simply renamed info.plist in the project to another name, restarted the simulator and everything is working fine since.
I frequently encountered this problem after renaming a project in Xcode 4.
I was able to fix it by editing the Bundle Identifier in the .plist file.
After I renamed the project, the Bundle Identifier would change to something like this:
com.yourcompany.${PRODUCT_NAME:rfc1034identifier}
changing it back to this:
com.yourcompany.${PRODUCT_NAME}
will stop Xcode from hanging and allow the App to run.
For me, none of these has worked. I realized that my project had 2 info.plist files (with two different names, like info.plist and Project-info.plist), so XCode got confused. I just removed the incorrect plist file, and it worked!
Under Product > Edit Scheme > Run > Info, changed the Debugger from LLDB to GDB worked perfect for me!
I had the same problem. The issue was there was one more user who was logged in and had the simulator running. Think there can be only one instance of iphone simulator running on a machine even for different users. Hope this info would be useful for somebody :)
What worked for me is the following:
In XCode:
Click on project name
Click on target name
Click on "Build Settings"
Reveal "Product Name" contents (click on triangle)
Make sure the name of all items matches that of project name
Example
Product Name myapp
Debug myapp
Release myapp
Reveal "Deployment" contents (click on triangle)
Make sure there is a "IOS Deployment Target" item
Example
IOS Deployment Target IOS 3.0
Debug IOS 3.0
Release IOS 3.0
Then clean and run.
This is what worked for me:
In Xcode navigate to the Product menu and choose EDIT SCHEMES.
In the list on the left choose Run YourAppName.app. From the Executable menu choose OTHER.
Navigate and choose your .app file in your project directory.
Now run and it works :)
I noticed it happened to me when I edited the scheme from Build Release to Build Debug.
I changed back, and it worked :)
What worked for me:
Launch "Monitor" and kill gdb-i386-apple-darwin which was supposedly hung
Restart iOS simulator
My solution is correcting the nib name. (I changed my nib name before for an iPad version but then I deleted the iPad nib file). Then it works well again.
All of the above suggestion didn't resolve my problem.
After I added the Resources folder and and compile, it hangs on attaching to app-name.
I removed Resources folder, still hang.
I removed the project and recreate a new one ( with the same name ) but still having problem.
If it was different name then it's ok. I restarted the OS but still doesn't help.
To solve the issue, I did the following:
1. ps -ef | grep Xcode, and kill all the "Xcode" processes.
2. Reset the content of Simulator, and quit the Simulator.
3. Product > Clean to clean up the build.
4. Compile and run the product. It should work at this point.
Hope it helps some else having this similar issue.
I encountered this error after incorporating another project inside my new one. Make sure you delete the project that you have added's info.plist and .app
Just came across the same problem: restarting the simulator and Xcode didn't work for me, while restarting my mac worked out pretty well!
After all said and done. I had to stop the simulator. Then the message change to downloading Mac OS X 10.6 core library.
Create a new user account, switch to account, open XCode and try running the project. After trying all of the other suggestions with no success, not only was I again able to run on sim, but the original account now works.