iPhone app fatal error - iphone

Ok, I only made a minor change to a project of mine in Xcode (I just added a new .h, .m, and .xib file, they're very small), and now it won't run and gives me this message:
"fatal error: error writing to -: Broken pipe"
WTF? So I removed all the changes and tried to run it again and it STILL gives me the error, what's the deal?

Restart Xcode. If it still throws the error, disconnect your iOS device, reboot it, attach it again.

Sometimes I get this error when I press run while my app is still working on the iphone. This may persist even if you restart xcode or your computer. What works for me is to hard restart the iphone. keep pressing powerbutton on iphone for 10 seconds untill it goes out and then press again, the error should go away.

Related

Xcode 4.6 builds, runs and finishes instantly (simulator iOS 6.1)

In xcode, I tried to add a tap gesture to my app and when I built it, it started a problem with Xcode. It goes from building, 'running on iPhone 6.1 simulator' to 'finished running on iPhone 6.1 simulator'.
If the simulator is closed, it starts up with a black screen and you cannot click the home button etc. If open, nothing happens, the app doesn't install but the simulator doesn't crash.
I have tried the armv6 architecture 'fix' but that didn't work. I have also cleaned the project and project data. I have reset the simulator multiple times as well.
If I add the old files to my new project, it works up to a point (I copy and paste old files into new) but then the same happens.
Thanks for your help in advance!
NOTE:
New blank projects build and run fine.
EDIT: It still didn't work after undoing my previous actions, and the simulator is responding according to Finder, although the screen stays black
–––––––––––––––––––––––––––––––––––––––––
UPDATE
I had a folder named 'resources' in my application, imported as a reference which, following links from the thread #arthan.v supplied me with fixed the problem. What I did was rename the folder to files and reimport it.
Thank you so much, I spent 2 days trying to fix it before now!
Click the Center Button in View on your right hand side of Xcode.
In your Bottom bar, you'll see error: failed to attach to process ID 0.
Check these error: failed to attach to process ID 0 and Xcode compiles my App, but can't run it in the simulator
This sometimes gets fixed by these steps:
iOS Simulator > Reset Content and Settings ... > Reset
Xcode > Build and Run
I experienced the same issue after I had re-organized some code and renamed the workspace and project. Eventually realized there was an old version of my test app on the simulator's homescreen. I delete that and then everything was building fine again.
You might need to add the device to the provisioning profile. I experienced this on Xcode 6 and a real device.

debugging crash errors on app launch

I am getting the following crash when I run the app on my device, but it works fine on the simulator:
Any idea of where I should probably start looking? This is super abstract to me
Also it seems that every time I run the app, I am getting a different error.
Here's a bigger image link
It might be because of zombie. Put the exception breakpoint in xcode and analyse.
In case if you don't know how to put exception breakpoint follow below steps:
Press cmd + 6 to open breakpoint navigator
Tap on "+" put present at the bottom left of the screen and select "Add Exception Breakpoint..."
Press Done.
Now run the program.
The program stops at the point where the exception is thrown. Analyse the problem and fix it.

How to display the exact line of code causing application crash in xcode 4 debugger like in xcode 3.2

I just downloaded xcode 4 recently and have read the xcode transition guide, however, I am still wondering how do I get the same feature for debugger in xcode 4 like in xcode 3.2.
When I program in xcode 3.2 and run my application, if my code happened to cause a crash in the program, I could just press command+shift+y and I'll get the debugger mode appearing, which will shows which lines that it crashes. However, I can't seem to get this working for xcode 4.
I know that I can look at which line that actually causes the crash by looking at the stacktrace, however, having that functionality in xcode 3.2 really saves me time. Just wondering if anyone knows how to do this in xcode 4 as well.
You need to add an exception breakpoint. Select the Breakpoint Navigator, click the Add (+) button at the bottom, then choose Add Exception Breakpoint... This should cause the debugger to pause any time it encounters an exception. Note, you have to have the Breakpoints button enabled (to the right of the Scheme selector in the toolbar). Note also, in Xcode 4, Run with breakpoints enabled is synonymous with "Build and Debug" in previous versions.

How to know why application crashes in simulator

I'm running my application on the simulator but as soon as it starts it just closes I guess it crashes, however I dont get any error message or reason why it's crashing, I'm running it as debug also, is there anyplace or anyway to get an error message?
Try switching to "debugger" view, and look at the console from gdb, if it crashes you will see the error, and hopefuly the call stack.
Example of crash message: EXC_BAD_ACCESS.
If you don't have the call stack visible, you can try to type 'bt' (for back trace) at the gdb prompt.
A lot of times when my application randomly crashes before launching, there is a problem in an interface builder file (such as a connection to a now non-existant object). Check your interface builder files to see any potential bad connections or errors and if you can't find any, put an NSLog in your applicationDidFinishLaunching method to see if the application is actually being started before it crashes.
In Xcode, choose Run menu, then choose Debug — Breakpoints On. Xcode should now point you to the location in code where your app crashes in the Debugger view.

Debuging to simulator crashes with "exited with status 5" unless I have breakpoint

For some reason the app I am working on has very bad PMT! Literally! Most of the time I cannot debug using the simulator without putting a breakpoint in my AppDelegate. If I don't it exists with "status 5". If I put a break point in and simple continue it works perfectly well, it also works if I run the app in the simulator when not connected to the GDB.
I have tried the source on a second machine with exactly the same results. I dont have this issue building to the device?!?!?!
Thanks
from : http://forums.pragprog.com/forums/100/topics/2168
Sep 14, 2010 9:55am
Mark Allen
(1 post)
I had this too. Fortunately I had the project under source control, so I did
a diff and realised the project file is not the culprit. Turns out there is no
need to create new projects or anything. Just delete your personal settings files
for the project. They will be username.mode1v3 and username.pbxuser. I didn’t
figure out which file was the cause, but deleting them sorted it out.
I had same problem. Restarting X-Code didn't help.
What did help was clearing all my breakpoints.
From the X-Code menu, click Run -> Show -> Breakpoints, then, from the breakpoints screen delete all breakpoints. Shut down the simulator, then rebuild the project.
Problem solved for me.