Reset Xcode 6.3 to its original state - ios

I am new to Xcode.
Recently Xcode on machine is broken.
I am getting error "Unable to boot up iOS simulator"
I tried lot of steps mentioned on stackoverflow and blogs but couldn't get it working.
I am hoping reseting Xcode will fix the problem. Even after uninstalling and reinstalling, Xcode is having previous state.
Is there any way to reset Xcode along with simulators ?

You will need to remove the Xcode.app data from ~/Library/Developer, which can be done from the command line (when Xcode is not running):
rm -rf ~/Library/Developer
You will then need to re-download the SDKs and Documentation from with Xcode. You might also want to check that the Command Line Tools are set-up from Preferences > Locations.
There is no need to reinstall Xcode.app, unless it's become corrupt, as nothing should ever write into the app bundle.
You might want to look at ~/Library/Application Support/Xcode as well, but on my system that folder is empty.

Related

Xcode 10.2: Internal error when debugging app

When I tried to run my app it could not launch on simulator or device, while throwing error.
Could not Launch "Carepilot" internal error
So I try Edit
sheme -> run -> info -> Debug executable
to make sure the Debug executable option is not checked, debug mode is disabled there, but this can't be debugged.
Anyone encountered same problem?
I'm not sure exactly why you're seeing that, but here are some basic debugging steps to try.
First, turn debugging back on, you'll want that. Any solution that doesn't let you debug is useless.
Second, quit Xcode and and quit the Simulator. Sometimes things get in a funky state. Relaunch Xcode and try again.
If it still happens, reboot. Try again.
If it still happens, try it with a new project to rule out any issues with yours.
If it still happens, go to Xcode>Preferences…>Locations`, do you have Xcode 10.2 (10E125) command line tools installed and selected? That's what you should see.
If that's not it, go to the Terminal and enter xcode-select -p. Does the path displayed point to the Contents/Developer directory under your Xcode app? If not, set that using sudo xcode-select -s /Applications/Xcode.app/Contents/Developer (substituting your Xcode app's name if necessary).
Unfortunately, "internal errors" in Xcode occur for various reasons and don't provide any useful information. If all else fails, you may need to try reinstalling.
I had this exact same issue after an Xcode crash. Turns out that the executable no longer existed after the crash, but Xcode continued to access it since the reference still existed. Because of this, receiving this exact error is common when trying to debug the build.
If you click on the executable reference in the Products folder you can get the full path for the old build executable from the inspector on the right. Where is the name of your project, this path should be something like this:
/Users/username/Library/Developer/Xcode/DerivedData/<projectname>-<randomhash>/Build/Products/Debug/<projectname>
With the offending path in mind, you can open a terminal, change to the DerivedData folder, and remove the build folder.
$ cd ~/Library/Developer/Xcode/DerivedData
$ rm -r project-randomhash
After removing the build folder, re-build your project and debug once again.

Xcode 9.2 / iOS 11 / Can't find folder

Apple recently demanded I upgrade my iPhone to the latest iOS version (11.2), and, as usual, Xcode then refused to connect to it unless I upgraded Xcode, which, of course, I could only do, if I upgraded my version of Mac OS.
So, after wasting half a day downloading and installing updates, I'm now on Xcode 9.2, and my code, which built beautifully before, fails to build with an error of:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/
Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/
Developer/Library/Frameworks'
(Note: I've added spaces in that folder path myself, to make it readable here.)
The error message is true though.
If I attempt to go into that folder, I can get as far as the iPhoneOS11.2.sdk folder, then there's no Developer sub-folder in it.
I have Googled this problem, and lots of people recommend checking your "Library Search Paths" and "Framework Search Path" settings... but in my case, both of these were blank. I didn't have any folders specified in my build settings.
Interestingly, in that screenshot above, I noticed that the System folder does have a Library\Frameworks subfolder so (out of desperation) I copied the System folder into a folder called Developer.
Ridiculously, this seems to have fixed the problem, but surely I'm missing something here...
Has anyone else had this problem, specifically since upgrading Xcode ?
After making this change to the folder structure, I did still have 1 other error. Xcode was now complaining that:
embedded dylibs/frameworks are only supported on iOS 8.0 and later
Again, this error hadn't appeared before I upgraded Xcode, but the fix was to change the iOS Deployment Target in my "Project" build settings and in each of the Target build settings.
What really bugs me about Xcode is that I don't want/need any of the new iOS 11 functionality. This is a legacy in-house app, which we've been using since iOS 7. This stuff should just build, after an Xcode update, but with each release, we get new problems, as obscure as the ones highlighted here.
This Xcode stuff is truly terrible... please can I go back to my warm-and-cosy Microsoft environment now...?
You can use your old Xcode to support 11.2
To support you need to run below command:
sudo ln -s PATH_OF_NEW_XCODE_DEVICESupport_TO_11.2 PATH_OF_EXISTING_XCODE_DEVICESupport
Example:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/11.0 /Applications/Xcode821.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

Xcode 9: Could not attach to pid

I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.
It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).
Could not attach to pid : “2370”
Ensure <project title> is not already running, and <system username> has permission to debug it.
Here is a snapshot for the same issue:
What would be permanent solution of this issue, as it's disturbing frequently?
If issue is on OS Mojave and you are trying, like me to run tests on older Xcode version (lower than 10.0), make sure that in your scheme, when you select Test, Debug executable is disabled
You won't be able to debug tests from this point
Still not a permanent solution, but I had to quit and restart Xcode as the other solutions did not work for me.
This worked for me:
Edit Scheme -> Info -> Executable -> Ask on launch
Credits to #nastya-gorban's answer here
Update
After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".
Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.
If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:
We suggest that you use automatic signing for your debug builds and
manual signing for your distribution builds.
Killing my simulator and then running it again from Xcode.
I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)
It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.
After removing the beta, it worked with the stable version.
delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that
I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.
I am using:
- Xcode v9.2
- Swift 3.2
- Building for iOS
The things that I tried that DID NOT WORK were:
restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.
What WORKED was as #Rajasekhar mentioned:
checked out the Keychain certificates.
deleted the exiting ones by right clicking (they'd passed expiration)
and unchecked "automatically manage signing" in Targets->General
After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.
Even on Xcode 11.1/2/3
It is an Authorization issue with Simulator,
When Simulator does not have the necessary access. It raises the issue.
Try following in Terminal
sudo DevToolsSecurity -enable
or
sudo /usr/sbin/DevToolsSecurity -enable
Details can be found here
I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.
Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.
What worked was to run Xcode (9.4) with sudo,
sudo /Applications/Xcode.app/Contents/MacOS/Xcode
I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.
The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,
error: attach failed: unable to attach
I had same issue. Check screenshot.
Below are few solutions that should work:
Rerun project
Clean (Shortcut: cmd + shift + K) and Rerun project
Quit Xcode and Simulator. Open project and run again
Reset content of Simulator (Select Simulator -> Goto Hardware tab -> Erase All Content and Settings…) and rerun project.
Solution 4 worked for me.
This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.
(most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings
(less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)
I was seeing this in Xcode 10.2 and the cause for me was that lldb-rpc-server was crashing. I worked around it by ensuring either Address Sanitizer or Thread Sanitizer is enabled in the debug options. I also filed a bug report viewable on Open Radar.
I tried all the answers above. The only thing worked to me is changing the build number.
In my case (Xcode 10.1), this was the error in the console:
kernel macOSTaskPolicy: (com.apple.debugserver) may not get the taskport of (bin) (pid: 10132): (bin) is hardened, (bin) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger
So the solution was to disable the Hardened Runtime, clean the build folder and run again.
This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.
This happens on my machine, when I set the 'new build system'
Go to menu file=>workspace settings and set Build System to "Standard".
I realise this is not a problem with a single solution, from all the other answers. So, here's what worked for me:
1) Reboot the machine
2) The first run always works for me. The only thing that helps me avoid this error after this first run, is to stop the application from XCode, instead of just clicking the Run button to re-run the application.
Another thing, when I lock my computer the issue re-appears sometimes (probably when I forget to stop the application). So I have to reboot my machine again.
After doing some digging, this worked for me on Xcode 10.3.
sudo /usr/sbin/DevToolsSecurity -enable
In my case the only thing that worked was switching back from the "New Build System" to the "Legacy Build System" in the Workspace Settings. Bummer.
It's an issue with authorization. Try this in the Terminal:
sudo DevToolsSecurity -enable
First, close app completely via sim (not sleep - close app totally)
If not working yet: reboot whole PC, ensure only 1 simulator is active upon reboot.
More than 1 sim can confuse it if it's bugging.

Xcode 7 or 8 issue with Pods, can't run at all

Getting this error for pods in Xcode when trying to run app:
error: A cryptographic verification failure has occurred.
Tried reinstalling Pods/repo
Reinstalling Xcode(s)
Also doesn't run on simulators:
Also, running Sierra at the moment (yes, I know).
This is a regression in macOS Sierra that multiple developers have reported in the forums and in the lab sessions at WWDC. Xcode 7.3 is not officially supported on Sierra. If you want to use macOS Sierra, please use Xcode 8.0 beta or later.
If you must use Xcode 7.3 on Sierra, you can partially workaround this bug by using Xcode.app to install the app through Build & Run, launch the app suspended from the command line (xcrun simctl launch -w booted <app identifier>) and then attach with the debugger and resume the suspended process.
Note that this issue only impact Xcode 7.3.1 downloaded from the Mac App Store. You will not hit this issue if you use Xcode downloaded from http://developer.apple.com (ie, the "drag & drop installer"). Note that you might hit another issue with the same symptoms when using the drag & drop installer. That is discussed in DTAssetProviderService could not start DTXConnection with Simulator
I got mine working now!! Not really sure what I did, at all, but I just deleted the Xcode 8 .app entirely and then I redownloaded it, opened up my project in it, did a pod install and pod update, and it's running in the simulator just like normal! Not sure what I did at all, but redownloading is worth a try, it is in fact possible to fix.
If you have reinstalled CocoaPods so that it updated from a version that is lower than 1.0.0 to 1.0.0 or above it can't hurt to delete your DerivedData folder of the project that is having problems. I don't know why it fixes a lot of bugs when above scenario is the case, but it does! You can do this by going to: Window -> Projects
Then select your project on the left (It was my "Piece" project for me)
Then click the delete button
Hope this helps you out!
Launch "Keychain Access", go to "Preferences..." and click "Reset My Default Keychain". After that I was finally able to build my projects.

Playground execution terminated because the playground process exited unexpectedly

I want to use a playground in Xcode 6.0.1.
So File -> New -> Playground
I get immediately the error.
Playground execution terminated because the playground process exited unexpectedly.
See image. Restart Xcode didn't helped.
Whats wrong with Xcode?
New Answer:
As #Woomin points out in the comments, first try restarting Xcode and rebooting your Mac, and if that fails try the following:
Try deleting the .simruntime files:
I found them located here in my root directory:
Old Answer:
If the above doesn't work try removing everything in the Developer folder located at /Library/Developer/. If this still doesn't work try removing everything in ~/Library/Developer/. If this still doesn't solve it remove xcode with AppCleaner and reinstall it using the MAS version. I found that doing this last thing solved the issue but it came back when I installed the simulators from xcode's download tab. Removing the .simruntime files finally solved it for me. BTW, I'm using version 7.2.
A restart of the mac solves the problem. What causes the issue is still unknown.
Thanks smileBot's answer. I am able to make it work with 7.2 too. I did try differently.
I installed Xcode 7.2 release version via downloading. However it had problem mentioned above. I first deleted the Xcode 7.2 via AppCleaner completely. Empty the trash. Also cleaned the derived data using WatchDog for Xcode And then restart the machine. Try again, it did not work.
So I went ahead deleted the folder ~/Library/Developer/ and then restart, try again, I can use Playground again in Xcode 7.2 again.
Xcode 7.2 and Mac os x 10.11.2
Restart Xcode or mac does not worked for me.
I solve this problem is that delete the Simulator Profiles. The Path is ~/Library/Developer/CoreSimulator/Profiles/Runtimes. Delete all Runtimes. Than Restart the Xcode, problem has been solved.
Install Command line tools using command
xcode-select --install
then u will get an update in Appstore install that app Problem will be solved.
OSX 10.11.2 and Xcode 7.2
I had gotten a reply to his from a member on the Apple Developer Forum and wanted to provide some additional information on my fix for this. First I deleted the ~/Library/Developer folder as indicated. Looking into it it had the some Simulator Profiles. I didn't know what that had to do with the Playground issue so I did NOT empty the Trash. I rebooted and the playground worked.
I put back the folder and the playground had the issues again. I one by one removed the simulator profiles in the sub directory ultimately removing ALL of the profiles without deleting the ~/Library/Developer folder structure and the Playground works.
With Xcode 7.2 (7C68) i had the same problem. I'd solve it by changing the entry of the runtime value from com.apple.CoreSimulator.SimRuntime.iOS-9-1 to com.apple.CoreSimulator.SimRuntime.iOS-9-2. I'd changed it in the device.plist. In ~/Library/Developer/CoreSimulator/XCPGDevices/ is one or more folder with a UUID as name. In one of this folders is the current device.plist.
It's not necessary to delete manually Developer's folder. Just follow this steps in Command Line (CL).
Quit Xcode.app, Simulator.app and all Xcode related and then in CL:
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator
A restart of Xcode solves the problem , most of the times . (Do remember to quit from the dock too)
If that doesn't work a restart of Mac is all that is required
This happened to me and I found that the platform setting wasn't set for my playground. Probably because the playground was created in a previous version of XCode which didn't require it.
Solution:
Double click on your playground to open it in XCode and wait for the fail message.
Dismiss the message (it may appear more than once) and do the following
1.Select to show the project navigator pane.
2.Select the workspace in the navigator.
3.Select to show the Utilities pane.
4.In the playground settings area of the Identity inspector. Select OSX (or iOS)
It is ok when Change the platform to "OS X" from inspector, but problem when back to "iOS". I don't know why...in Xcode7 Beta.
Plus, it is ok in my Xcode 6.4 for both platform when playground.
And there is one more option for iOS platform "Run in Full Simulator",besides "Render Documentation"option. in My Xcode 6.4 inspector
and I have check the "IDEPlaygroundSettings.inspector" in
/Applications/Xcode.app/Contents//PlugIns/IDELanguageSupportUI.ideplugin/Contents/Resources/IDEPlaygroundSettings.inspector
and
/Applications/Xcode-Beta.app/Contents//PlugIns/IDELanguageSupportUI.ideplugin/Contents/Resources/IDEPlaygroundSettings.inspector
they are quite different.

Resources