Xcode 10.2: Internal error when debugging app - ios

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.

Related

Problem with running IOS simulator for my flutter app

I'm trying to run my flutter app on the IOS simulator and its not working. So tried on the most basic flutter app (create my_app and then tried to run it) and nothing seem to work!
Everything seems to work fine when I run it from the terminal until the linking and signing phase and that where I get the error, how can I fix it?
This is the error I get:
Unable to install
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app on
82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15. This is sometimes caused by a malformed
plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command
(domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8B
B9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoord
inationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-BC2E
82D37D17/my_app.app to installd
Underlying error (domain=MIInstallerErrorDomain, code=103):
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8
BB9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoo
rdinationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-B
C2E82D37D17/my_app.app to installd
Command: /usr/bin/xcrun simctl install 82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 11 Pro Max.
Edit:
I updated my MacOS, Deeleted and reinstalled Xcode, I even tried to run the most simple swift app and I get always this same error, it looks like the build was successful but it unable to install. I still get this same error, what can I do?
This occurred when I opened the Simulator first and then updated XCode -- even without running the app until after XCode updated completely.
What worked for me:
Close Simulator completely (from the dock, right-click -> "Quit")
Close XCode (if applicable)
Run flutter clean
Re-open Simulator
Re-open XCode and let it compile
Run the app again
If it still does not work, try resetting the device at "Device" -> "Erase All Content and Settings..." from the Simulator menu.
I had the same issue a couple of days ago
What I did - and what fixed the problem - was to reset the simulator (Device -> Erase All Content and Settings), and then run $ flutter clean
You should now be able to run your app again
None of the above worked for me. I created another flutter application and copied it's ios folder to my project. Worked like a charm
Save time, just go to erase device content and settings from the emulator, then run flutter clean. App should run fine then.
Run flutter clean and then run your app again
If error persist, generate a new flutter project on Android studio. Replace the ${projectHome}/ios/Runner.xcodeproj folder with the ${newFlutterProjectHome}/iOS/Runner.xcodeproj. Your app should run fine now.
If error persist still, delete the ios folder and replace it with a new one copied from a freshly generated project.
This happens if the GoogleService-Info.plist is missing.
This also happens when you have updated your XCode and your simulator is in the background.
Close the simulator and open the Xcode, you will get an option to install additional tools, install them and then run the application.
An alternate solution is to run the Runner.xcworkspace app once from Xcode and this may fix it.
In my case it was because of hanging empty GoogleService-Info.plist file inside Xcode after migrating to new Firebase (FlutterFire) initialization.
Xcode is not a regular drag and drop IDE which directly maps project files to the ones in the file system. It rather caches file references. So even when you delete a .plist file, the Xcode still maintains a reference to it.
Simply opened Xcode IDE and removed .plist file (which updated project.pbxproj in turn). This helped me to compile the project fine.
I had this same issue recently. I found out I added my GoogleService-info.plist file to the subdirectory Runner and not the main Project directory Runner through xcode. I opened up xcode again, deleted the file and re-added it to the proper place and now everything is working correctly.
for this you have to give some value in CfBundleVersionShortString like
<key>CFBundleShortVersionString</key>
<string>1.0</string>
And Give the build value in Runner as 1.0 and version as 1.0
enter image description here
To be honest. it's really frustrating for the developers
This is how I fixed!
flutter clean
flutter pub get
go to ios folder
rm Podfile.lock
pod repo update
pod install
Then it works!

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: invalid symlink error when trying to run app in iOS simulator

At the end of my app's compilation phase, I see an invalid symlink error.
This is just some temp directory that's created every time I run. I tried deleting it to no avail.
The app runs fine on device.
Any help would be much appreciated.
That error usually happens when your app contains a symlink that points outside the app bundle. When building for device or the Simulator, Xcode creates the app bundle, then copies it out for MobileInstallation to do the install or update. MobileInstallation will not install an app that has symlinks to locations outside the app bundle.
Do you have any simulator-specific build scripts or steps? Does your bundle contain any symlinks? Open the Products group in Xcode. Right-click on "<name>.app" and select "Show in Finder". Right-click the app and select "Show Package Contents". Examine the app for the presence of any symlinks. You can also open that directory in Terminal and use ls -al. Any links will have an l character in the first position.
The other possibility is you have a file permission problem or other filesystem corruption. Run Disk Utility to check for errors. Assuming everything is OK, you can reset your Simulators with xcrun simctl erase all.
I had same problem. cleaning the project build directory fixed the issue for me.
I had same problem once, then i deleted the simulator from opened window after followed way "Set the active scheme -> Add additional simulator".After that i added a new simulator. I'm not sure about the solution for you.
Second way to solve the problem (in my opinion), check the simulator path "Finder -> Library -> Developer -> CoreSimulator -> Devices" like this. After that, find your project simulator then delete it :) and run the project on the same simulator again.
I hope it works for you. Good luck.

Reset Xcode 6.3 to its original state

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.

Cannot start Xcode 6.1.1 after duplicating the app folder

On our build system, we need to preserve multiple Xcode versions in order to also build older projects. We duplicate the Xcode app folder for every major Xcode release (from within Finder).
However, after duplicating the Xcode 6.1.1 folder, I couldn't start the app. After double-clicking on the duplicated folder (Xcode-6.1.1.app), it briefly showed the "Welcome" screen, then immediately closed it and showed an alert saying:
/Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/dyld_sim is not owned by root.
The original Xcode.app can be opened normally. I could reproduce this problem on both Mavericks and Yosemite.
Has anyone seen this? Any ideas how to make the duplicated Xcode working? Thanks!
Open Terminal and just type this code
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
enjoy multiple version of xcode :)
type following command in terminal:
The xcode-select commands did not work for me. So I deleted that copy I made with the Finder, and used the free Duplicate (which copies permissions and other metadata correctly when it makes the duplicate) to copy it from a backup. After that it launches flawlessly.
I fixed it with chown:
sudo chown -R root /Applications/Xcode6.1.1.app/

Resources