Xcode 4.4 on iOS 5.1 build succeeds but run hangs on simulator with debug message 'Failed to attach to process id <pid>' - ios-simulator

Symptoms: Running any iOS 5.1 application from Xcode 4.4 (and 4.4.1) will launch the iPhone simulator but result in a plain black screen. In the Xcode console, the message "error: Failed to attach process to id " is displayed, being different each time. Attempting to 'Stop' the application from Xcode does nothing, and only Force Quit will return Xcode to a working state. Pressing the 'Home' button on the simulator shows that the app was successfully installed. Sometimes, opening the app from the simulator will show the UI, but no console messages are displayed, even after manually performing 'Product->Attach to process.'
Attempted Solutions: Xcode 4.3.x was originally installed on Lion, working charmingly. The problem started at installation of Xcode 4.4 in early August, for a project which was working before. I upgraded to Mountain Lion, didn't help. I reinstalled Xcode, didn't help. I upgraded to 4.4.1 Aug 7, didn't help. I deleted all trace of Xcode data, running: find / -name '[xX]code' and deleting all super-folders where it seemed relevant. That (not surprisingly) caused some OS issues, since subsequently reinstalling Xcode just didn't work. I then did it again, reinstalled Mountain Lion (to restore some OS files I probably killed), then reinstalled Xcode 4.4.1.
For projects, I typically ran new, single-view projects each time. Lately I've tried using this sample project from Apple, per link 3 below. I tried all the clean builds, etc., but honestly, one would assume opening a fresh project should just work. Just for kicks, I put a single 'Label' object in the iPhone storyboard at times.
After doing some homework I managed to find the following questions most similar to mine, but none are exact nor do any of the solutions work (in order of decreasing relevance):
xcode-4-4-ios-5-1-simulator-problems
crash-of-xcode-4-4-for-mac
failed-to-attach-to-process-id-xcode
unit-test-target-doesnt-run-on-xcode-4-5
xcode-4-4-freezing-on-project-close
simulator-keeps-crashing-in-xcode-4-4
Any help would be greatly appreciated. I apologize for the lack of brevity, but I've spent probably 15 hours trying to find/implement solutions to a seemingly trivial problem, and I would rather provide all relevant information than to have you guess at what I did. I'm not going to specify all the build info, just because it's whatever comes stock on the fresh install of Xcode.

I had similar problem (although with different configuration) and found incredibly simple solution by chance. I just used Product->Stop, then Product->Run (through keyboard shortcuts if that matters). Just once! Then the problem disappeared.
configuration: XCode 4.2, iPhone Simulator 5.0
symptom difference: process attaching didn't fail
It seems to me that the problem stems from the XCode-Simulator communication, and that's why I've shared my experience here despite the differences.
EDIT: It comes out Stop; Run didn't provide permanent solution for me. The problem is recurring from time to time. Still it is a temporary workaround for me.

I got this a few times, especially when I kept running my app and cancelling it or interrupting it too often, it's not something you can put your finger on, but yes I always managed to get back up and running by deleting the app in the simulator, cleaning project and build folder, deleting derived data (in Xcode organiser > projects view), restarting simulator and Xcode.
This also happened a few times on the device, and I needed to restart the device, iPhone in my case. I hope these infos help you out.

I got this to work by building and running the simulator using the Xcode 4.5 developer preview. I then closed it out and reopened Xcode 4.4.1 and it built and ran fine.
While none of the solutions above worked for me, thanks for putting this all together. I figured I'd answer here since this was the most comprehensive.

While this isn't exactly a solution, after today's OSX 10.8.1 update from Apple, this issue has been resolved. It's safe to say that some bug arose in the process of installing Mountain Lion and Xcode 4.4 that was fixed with this update to OSX.

I think I've cracked this one for my particular case, and I admit it's somewhat a mistake only newbies should do but I had overrided
viewWillApear:(bool)animated {}
in a ViewController of mine, without calling back
[super viewWillApear:animated]
It might be a good idea to search for all view lifecycle methods in your project and see if you have similar problem.

Related

Xcode 8 Simulator crash

I recently downloaded the Xcode 8 beta. When I try to open the simulator, it gets stuck on the black Apple screen and I get a crash message for "SpringBoard".
Any ideas? I'm happy to edit if I left out anything.
Thanks in advance!
This is a known issue that is mentioned in the release notes and is related to issues in the download and install process. If you don't follow the installation instructions exactly, you can trip over this issue.
The workaround is rather straight forward:
Using Finder, copy (DON'T MOVE) Xcode-beta.app from /Applications to ~/Desktop
Delete /Applications/Xcode-beta.app
Move Xcode-beta.app from Desktop back to /Applications
I had a similar problem which, with a bit of googling, I managed to solve as it happened with the Xcode 6 Betas too. First of all, make sure that your Xcode-Beta.app is in the Application folder of your computer. Then go Xcode -> Preferences -> Locations. In "Command Line Tools" you will probably find that you have Xcode 7 selected. This is a problem that occurs with having 2 Xcode versions installed. Change it to Xcode 8.
After this, the simulators were still broken for me, so I went to Xcode -> Window -> Devices and delete all of the simulators. Then try a full reboot of your computer. Reopen the devices page and add in the simulators that you would like, and then right click on the Xcode app in your dock, and go "Open Developer Tool -> Simulator". Check that it now boots correctly. If its working so far, then you should be good to run your application. Otherwise try yet another reboot, just to make sure Xcode is refreshed.
Hopefully this solves your problem like it did mine, let me know if not.
SpringBoard failed to launch application with error: 0
If you get above issue make your simulator active window and follow step showed below in picture..
Note : It will delete all app from simulator..

iOS Simulator failed to install the application

I have created a Cordova 2.1.0 app, It ran fine for the first 2-3 times. But now when I am trying to run it through terminal it is giving me the following error.I didn't change anything.
Ankurs-Mac-mini:~ ankur$ /Users/ankur/Desktop/CordovaSMS/cordova/emulate
Ankurs-Mac-mini:~ ankur$ 2012-10-17 16:11:08.695 ios-sim[7032:507] stderrPath:
/Users/ankur/Desktop/CordovaSMS/cordova/console.log
2012-10-17 16:11:08.698 ios-sim[7032:507] stdoutPath:
/Users/ankur/Desktop/CordovaSMS/cordova/console.log
[DEBUG] Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain
Code=1 "iOS Simulator failed to install the application." UserInfo=0x7fc643902320
{NSLocalizedDescription=iOS Simulator failed to install the application.,
DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
any help would be appreciated.
Thanks
Solved the problem
Deleting contents of ~/Library/Application Support/iPhone Simulator and re-run the project solved this problem.
or you can simply reset content and setting of the simulator.
Try manually launch the iOS Simulator and from the "iOS Simulator" menu, click "Reset content and settings", then close and rebuild your app.
My solution is:
From menu, iOS Simulator, Reset Content and Settings.
Close XCode 5.0: close project and close it from Dock and re-open the project and launch again, like in Windows :)
I tried everything mentioned above and nothing worked. My problem was iOS 7 specific. I was finally able to resolve the issue by assigning a non-empty value to Bundle versions string, short (CFBundleShortVersionString) in the -Info.plist file. Looks like iOS 7 doesn't like an empty value for the build number. I had a script that auto increments the bundle number by 1 every time I build the project so this field was empty. I just assigned a dummy value there to get it working.
You can also remove the app from the simulator.
This worked for me in iOS6.1
Solved here: https://stackoverflow.com/a/16279286/1927253
I copied a folder into XCode 4.6.2 with the name "Resources". When XCode asked, I created the folder references for any added folders.
Every time I did this, I would have to goto the Derived applications directory, and delete the build directory for my project to get it working again.
Solution: Do not copy a folder by reference into XCode with the name "Resources". Rename it to something else other than Resources.
Very annoying error.
just reset your simulator and re-run your project
Unfortunately none of these solutions solved my problem. I did everything, even restarting my mac but it was still failing. What actually did solve my problem was to go to the Organizer and delete the Derived Data and Snapshots.
Had the same problem after installing XCode 5. Had no iOS 6.1 Sim or SDK. Obtained these. Tried to run the App up under the iOS6.1 Sim and go the failed to install message. Having read through all of the above posts, I decided to simply remove the App from the Simulator and re-istall, re-run from the project window and that solved it for me.
I tried ALL these things and more including reinstalling Xcode 5 and nuking every xcode and simulator preference/application support file with no luck.
Then for the hell of it, I CHANGED my short bundle version string (it already had a value, it was not empty), and it fired right up.
3 hours gone but yeah
All the answers I looked for do not work for me!.
Finally
The only way to make it work is as follows
1.Check the version of titanium being used for the project in tiapp.xml
2.right click the prject in the project explorer window.
3.Select Properties
4.Choose project build path. Select Titanium Mobile SDk all versions of 3.* Tick all of them.
5.Now click apply and re run the project.
None of the above worked for me, I finally compared my info.plist to another project and found that I had somehow deleted the "Executable File = ${EXECUTABLE_NAME}" key/value pair, replacing it fixed the problem for me.
This error occurs on iOS 7.0 if you leave the "Build" empty.
Enter a build number!
What worked for me was to simply delete an old version of the app, which was made in a prior version of Xcode (likely 4, now running 5) from the simulator (tap-hold, jiggle, x).
I encountered this problem while trying to create a build for Facebook application approval. I found that for some reason, when I used the following command line:
xcodebuild -arch i386 -sdk iphonesimulator7.1 -scheme Mana -configuration Release
the files didn't end up in [project root]/build/... (as the instructions on Facebook suggest), but in ~/Library/Developer/Xcode/DerivedData/[app name + unique identifier]/Build/Products.
I'm not sure exactly what's going on here (anyone who knows more please enlighten me!) but I was able to run the files in the DerivedData directory on the simulator. Hopefully they'll also work for Facebook!
I tried everything mentioned above and nothing worked.
Finally the only way to make it work was unsetting DYLD_INSERT_LIBRARIES=/usr/lib/libimckit.dylib
How I did this:
Open terminal and typing "sudo vi /etc/launchd.conf"
Changing
"setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"
to
"unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"
Save changes
Reboot your system
In this post [1] explain what DYLD_INSERT_LIBRARIES is for
[1] https://stackoverflow.com/a/26053165/2091181
On Mavericks 10.9.5 using Xcode Version 6.0.1 (6A317) with an iOS SDK supporting 8.0 originally had Simulators all version 8 all getting this error. All the advice above was not working for me. So went to Xcode->Preferences->Downloads and saw as installable (but not yot installed) in the Components section were iOS Simulators 7.1 and/or 7.0. Went ahead and installed the 7.1 Simulators and got extra designations on the Product->Destination list Simulators of version 8.0 and 7.1, and using the 8.0 still had the same error, but the 7.1 Simulators all worked.

Xcode 4.2: Error 0xC002 when trying to use a jailbroken iPhone 3G for development

I have this jailbroken iPhone 3G with iOS version 4.2.1 (the latest supported version). When I connect it to Xcode 4.2, Xcode starts copying the debug symbols. It stops copying towards the end of the process, and shows the following error:
Xcode has encountered an unexpected error (0xC002)
No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’
Anybody experiencing anything similar?
I know I should try and restore the phone, but I'm asking just in case anybody can come up with a solution that doesn't involve restoring it.
In this post on mactechnews.de, one guy reports the same problem -- with no solution, so far.
Alright, after a lot of testing and digging up the filesystem... I solved it.
It turns out that there are just a few files that are not downloaded from the device (for reasons still unknown). They are related to the dyld cache (don't really know what this is and what it's for). Here are the steps to make your 4.2.1 device debuggable in XCode 4.2 and 4.3.x:
Close Xcode
Go to: ~/Library/Developer/Xcode/iOS DeviceSupport/4.2.1 (8C148)/Symbols/System/Library/Caches/com.apple.dyld/ Note: if you don't have this folder, run Xcode, connect your device, and wait until the error 0xC002 appears in Organizer - the folder should be created by that time.
Create 3 empty files there called:
.copied_dyld_shared_cache_armv6
.processed_dyld_shared_cache_armv6
dyld_shared_cache_armv6
Run Xcode and enjoy the light next to your device eventually go green:)
Or, for the terminal lovers:
cd ~/Library/Developer/Xcode/iOS\ DeviceSupport/4.2.1\ \(8C148\)/Symbols/System/Library/Caches/com.apple.dyld/
touch .copied_dyld_shared_cache_armv6
touch .processed_dyld_shared_cache_armv6
touch dyld_shared_cache_armv6
This is obviously a hack but it works perfectly for debugging and I haven't noticed any side-effects so far.
Enjoy!
Small update:
I tested it on my snow leopard hackintosh, with the Xcode 4.2 (most recent to date) and although the device is active in the organizer and it is possible to run the app on the device, i get black screen on launch. It gets installed but apparently debugger cannot get attached. I had the same problem with 4.0.2, when the 0xC002 problem didn't yet occur so I think it's unrelated and might even not happen to others. Nevertheless, 0xC002 is still solved.
On my main development machine with Lion and Xcode 4.3.2, device is perfectly debuggable.
The answer above (https://stackoverflow.com/a/9944892/1390251) works, basically,
but for newer versions of Xcode you probably need to rename the files as follows,
having them end with '7' instead of '6':
touch .copied_dyld_shared_cache_armv7
touch .processed_dyld_shared_cache_armv7
touch dyld_shared_cache_armv7
If not sure, you can keep both sets of files (...6 and ...7)
in the relevant folder (can also be 5.1.1 for that matter)
and it should work.
(have tested it on iPhone 4 with iOS v5.1.1 genuine)
It seems that you cannot debug apps on iOS 4.2.1. I tried several restores to iOS 4.2.1 with same effect. Downgrading to iOS 4.0 was the only thing that worked.
The reason for whole problem is that iOS 4.2.1 is not supported in XCode, according to this website.
Error in Xcode getting debugging info from 5.0.1 iphone
solved, see the link to archive with iOS5.0.1 debug info
download & unpack to "~/Library/Developer/xCode/iOS DeviceSupport/" & be happy =)
I fixed this bug in![enter image description here][1] this way:
I duplicate the 5.1.1(9B206), rename it to 5.1.1(9A405)[my ios device is this version], then the error is gone.

XCode 4.0 internal logic error. will updating to 4.0.2 help?

I'm running XCode 4.0 I'm getting that error:
Xcode encountered an internal logic error. Choose "Continue" to continue running Xcode in an inconsistent state. Choose "Crash" to halt Xcode and file a bug with Crash Reporter. Choosing "Crash" will result in the loss of all unsaved data.
and also when i click on the show details button it gives me this:
ASSERTION FAILURE in /SourceCache/DVTFoundation/DVTFoundation-215/Framework/Classes/PlugInArchitectu re/DVTPlugInManager.m:215
Details: (extensionPoint) should not be nil.
Object: <DVTPlugInManager: 0x2000a3c20>
Method: -_extensionsForExtensionPoint:matchingPredicate:
Thread: <NSThread: 0x200020600>{name = (null), num = 1}
Hints: None
Backtrace: .............
I get this error if I try create a new file or modify any preferences, If I do just about anything. Could it be the actual project, it doesnt seem to happen with other projects.
It ran fine till I tried to add the Facebook IOS SDK to my project and then XCode "fell over". I have since removed the facebook SDK and still it happens I also opened a previous version of my app and still the same error.
I've tried clearing all the cache and still nothing works, is it worth downloading XCode 4.0.2 to resolve this or are there maybe other options. I'm in South Africa and 4 Gigs of data isn't for free.
I guess updating XCode to the latest version is always a good thing but is it that much better than 4.0? If there are other options to fix or find the problem, I would prefer it.
Thanks
I tried everything I've seen under this heading to stop xcode from crashing when debugging a simple C project. I even completely reinstalled Xcode4.
Finally tried this and it stopped the problem.
cd to the xcodeproj directory and:
rm -rf project.xcworkspace xcuserdata
I believe what I did that led up to the long series of crashes is set a watchpoint on a variable. I'm uncertain, but it was nearly the last significant thing I did before Xcode started puking on my shoes irrevocably.
I fixed the problem, although upgrading to 4.0.2 didn't do the trick, what I had to do is create a new project, and transfer all my files and change all my build settings after this it ran smoothly ever since. Hope this helps someone.
I had the same issue with a project stored in subversion.
I removed project.xcworkspace and xcuserdata from the xcodeproj directory and I also removed all .svn directories.
Building worked fine after.

Symbolicate XCode4 crash reports

I'm trying to get XCode 4 to symbolicate a crash report. I've googled and followed this link (https://github.com/chrispix/symbolicatecrash-fix) but get stopped. The instructions say "To fix your iOS crash report symbolication, move /usr/local/bin/symbolicatecrash aside and copy in the version in this repo." Well, I cannot find "/usr/local/bin/" on my Mac. I'm new to the Mac world, so I'm sure there's something I'm not understanding. If "/usr/local/bin/" doesn't exist, then where is XCode 4 finding symbolicatecrash? Please point a newbie in the right direction as I have a lot of bugs to be fixing.
Thanks
Tom
that tool has been relocated to /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash in newer version of the SDK
you would run it as:
./symbolicatecrash -A -v [crashlog-filename] MyApp.dSYM
keep in mind this is for iOS only, for OSX see http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html (for the app to contain the symbols "DWARF with dSYM" must be enabled in it's build settings)
you would run it as:
./symbolizecrashlog [application-name] [crashlog-filename] > symbolized.crash
I would like to add that all this usually is done automatically, these manual approaches are for cases when there are issues with the system symbols database as discussed in Xcode 4 failure to symbolicate Crash Log

Resources