Xcode 14 Beta - Build Issues with LLDB - ios

I am having issues when building any app with an iPhone 11 Pro or iPad Pro as the physical device destination. A new instance of a standard template app with Hello World takes moments to build and install on the phone, but then the app freezes on a black screen. Console reports the following.
warning: libobjc.A.dylib is being read from process memory. This indicates that LLDB could not find the on-disk shared cache for this device. This will likely reduce debugging performance.
Interestingly, if I stop the build in Xcode, which quits the app on the device, then manually launch the app on the device, everything works as expected but no logging of course. Reverting back to Xcode 13.4, the same issue occurs suggesting its an iOS 16 beta issue?
Further testing suggests this is an issue with the debugger. If I allow Xcode to build and run an app to one of my devices, it will launch and then freeze on a black screen. After a few minutes the app progresses to its main ContentView and the console appears to then function as normal.
Any thoughts? Thanks.

To those who bump into this later (or future-me) - I had the same issue.
Entirely removing the Device Support folder and re-opening Xcode forces it to recreate the device support files.
tl;dr
rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport
And then re-open Xcode.

More context:
lldb uses the gdb-remote protocol for reading memory from a device. This has the benefit of being a widely supported protocol, but it is not blazingly fast. So lldb will work much better if it has copies of the binaries that get loaded into your program on the local host where it can inspect them directly.
Xcode is the one that makes that happen. When you plug in a device and start up Xcode, if the OS is one Xcode hasn't seen before, it copies the system binaries over in one gulp and puts them in ~/Library/Developer/Xcode/{DeviceType} DeviceSupport/SystemVersion. If this process fails for some reason, then lldb will have to fall back to reading symbol information from the device, which is slow - that's what the warning is warning about.
If you delete the current version of the DeviceSupport directory, the next time you try to debug, Xcode will copy the binaries over again. If the error you had was transitory, then that should fix the problem. If not, it would be good to file a report with Apple Feedback to figure out what's actually going wrong.

Just open Xcode, it will ask you to install some required additional components. That's it.
It happens after updating Xcode or Mac OS.

Updating xcode then reopening it did it for me.

Merging the current top-voted answer and the steps in the other question's solution worked for me only:
rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport
Open the Xcode project/workspace with your device connected
Wait until the “Fetching debug symbols” process finished
Close the Xcode
Reopen the Xcode again and try to Build and Run on your device

You are using Connect via Network. Uncheck it and use a Cable. Looks like some recent Issue in iOS 16

I had this issue while using flutter and iPhone. I fixed it by just running flutter clean and then flutter pub get in the terminal and worked. Incase any are having the issue while using flutter.

If you are using 2 xcode apps try deleting 1 old one might fix it

Related

Xcode 13/iOS15 is taking longer than expected to launch, it shows a LLDB related message

I am using Xcode 13 on a Macbook Pro (Intel/2019) with macOS Big Sur 11.6
I am building and launching the app on a connecting iPhone X running iOS 15.0, I am also running a UI test suite based on XCUITest while I do that.
The app takes extremely long to launch (2+ minutes), then it sits on the splash screen for another 2-3 minutes. Meanwhile, Xcode shows the alert attached:
I have 2 questions:
Is this a widespread Xcode 13 / iOS 15 issue?
What does the message in the alert mean: "LLDB is likely reading from device memory to resolve symbols"? Is there anything I can do to reduce or avoid this wait?
Once your debug session is running, pause your app (or hit a breakpoint) and in the Debugger Console window, and do image list. This will list every binary / dylib / framework in the process, there will be as many as five hundred these days.
After the filename, if you see a hex address, then lldb has had to read all of the libraries out of memory on device startup. Xcode expands a local copy of all your device libraries on the Mac so lldb can find them there, instead of reading them from memory.
If you look in ~/Libraries/Developer/Xcode, there's a iOS DeviceSupport directory. You can remove it, re-launch Xcode and it will re-expand the libraries for your iOS etc devices as they're plugged in.
For those that are not familiar with the command line, go into your terminal and you can do this command.
rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport
This will recursively delete everything in the file tree in the 'iOS DeviceSupport' folder.
The steps are
Disconnect your device
Quit Xcode
Open a terminal window and run the above command.
Open Xcode
plug in your device and run your app.
The first time that you run the app will take a while as your computer re-obtains the information that you deleted, but subsequent runs of the app should work much faster.
That is what worked for me.

Xcode 12: Failed to start remote service "com.apple.debugserver" on iOS device

I updated my Xcode to Version 12.4 (12D4e) and after that I am unable to run my app on my device
iPhone X iOS 14.4.2.
Its alway show this Error
When I check my device connected status, Its show as connected
Action I applied
Clear DerivedData folder.
Unpair device and connected again.
Drank 20+ coffees.
I was able to fix the Xcode 12 app install/deployment issue described above:
Failed to start remote service "com.apple.debugserver" on device.
Domain: com.apple.dtdevicekit
Code: 811
Recovery Suggestion: Please check your connection to your device.
User Info: {
DVTRadarComponentKey = 261622;
}
...
by doing the following steps:
Quiting Xcode.
Deleting Xcode cache directory (ie, rm -rf ~/Library/Caches/com.apple.dt.Xcode).
Rebooting the offending iOS device.
Connecting the iOS device to Xcode by cable (instead of wireless network connection).
Starting Xcode again.
By the way, I've a setup very close to yours:
Xcode 12.5 (build 12E262) and
iOS 14.5.1 (on a iPhone Xʀ device)
1st solution
I fixed this by:
Closing Xcode
Deleting the current iOS version in my folder that's related to my device.
~/Library/Developer/Xcode/iOS DeviceSupport
Restarting Xcode. Wait a little bit for it to refresh and copy cache files in my case then Run.
Based on Can I delete data from the iOS DeviceSupport directory? it's ok to delete the iOS DeviceSupport folder.
I noticed when I did it and reconnected my device it re-downloaded the iOS device Support files.
If the support files don't download and the cache files are not copying, try restarting your computer as well.
I started also getting this error:
Errors were encountered while preparing your device for development.
Please check the Devices and Simulators Window.
Restart your phone and reconnect it to the compter if this happens. Then you should get a message in Xcode saying:
Preparing your phone for development.
2nd solution
Unpair the device in Xcode.
Clean the project.
Unplug and then restart iPhone.
Restart Xcode.
3rd solution
If none of the above worked, I was able to run the program by re-enabling Connect via Network.
After doing this now I can run project via USB.
4th solution
I submitted this bug to Apple. Apple also suggests this can be caused by faulty data cords. Maybe try another cord as well.
Unplug the iPhone, Turn it off and again turn it on and reconnect. It worked for me. Sometimes iPhone Debug connection network server clogs up. When you restart iPhone it reinitiate the connection.
This issue keeps happening and it seems like there's a myriad of reasons that may cause it, and so there are a lot of solutions that fixed it for people. Someone even suggested that none of the fixes actually work, and it's only the fact that time passes as we try different solutions that actually fixes it. Nevertheless, I will share what worked for me and what I found so far.
a. In the past, the issue was most often caused for me by using an older version of Xcode with a newer iOS. Apple doesn't always release the version of Xcode that supports the latest iOS at the same time, and this issue sometimes happens as a result of that. There are people who suggest right clicking the Xcode App > Show Package Contents > Developer > Platforms > iPhoneOS.platform > Device Support and renaming the folder for the latest supported version to the one running on the phone (for example renaming 16.0 to 16.1). I've had better luck with using the Beta of Xcode if it's not out yet (in this case using 14.1 RC2 instead of 14.0.1).
b. Incrementing the build number and setting a Display Name. This seems to have fixed the issue after nothing else worked. Again, this seems very random, so it could be unrelated, but it did fix it in my case after nothing else suggested on all the threads about this worked.
c. Deleting the profile in Settings > General > VPN & Device Management
Other suggestions I've seen across threads:
Restarting the device (seems to be the most popular solution)
Unpairing the device
Checking device status under Window > Devices and Simulators. There may sometimes be some further info about what is going on here, the device may still be preparing for development or downloading symbols or whatever
Using another cable. This never worked for me, after trying with 3 cables, 2 from Apple and one 3rd party, but others reported it worked
Deleting Derived Data (use Dev Cleaner or rm -rf ~/Library/Developer/Xcode/DerivedData
Uninstalling the app manually from the device
Resetting Network Settings
Force restarting the iPhone
Apple really needs better errors and less ridiculous bugs like this.
I had to update Xcode to fix this issue because my version of Xcode did not support my up-to-date iOS version.
I've had the same issue and also had the problem that I wasn't able to connect my device by cable (it popped on and of), so I had to use wifi connection on Xcode.
I was able to see the icon of the app created by Xcode on my iOS device, but whenever I tried to start it, it won't do so giving the "Untrusted Developer" error message.
I fixed this by going to:
Settings > General > VPN & Device Management > Developer App
Here you have to chose the App and consent to trusting it.
I reset the iPhone network settings and it works!
I have the same problem, my solution is update my ios version(15.1 to 15.2 beta)
I tried all the resolvent, nothing worked
restart iOS, Xcode, macOS
clear DeviceSupport, Caches
unpair iphone, change lighting cable
Then I find my ios version(15.1) does not exist in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport.
I try to fix it, but failed.
Finally, I can only update my iOS device to 15.2 beta version, It solved! Xcode is update to beta version too.
My devices original version:
iOS 15.1
Xcode 13.1 (13A1030d)
I'm on Xcode 13.3 and I fixed this by unplugging and plugging the cable between my MacBook Air and my mini iPad 3.
I fixed it by,
Following the steps : Window > Device and Simulator > Select your device and Right Click on it > Unpair after that re-connect your iOS Device then boom... Clean builds and run the app, it will work for you.
Upon solutions aren't working for me. Restart my iPhone then all well done.

Xcode 12 Apple Watch Debug Cycle

I just got back into iOS / WatchKit development after a ~8 year break. I'm having a really hard time making an app for the watch, because
Simulator is not helping because random things seem unsupported (most recent example being WCSession.transferFile, which apparently is a bug)
On device is not helping because the loop to get it to run on device is completely out of hand, and I was not able to get either logging or debugging to work when running on device. (My main problem is that if I do CMD R in Xcode with my Watch selected as target, it builds, and says running, but never launches the app. If I launch the app manually I find it's not the most recent version. I have to go and remove it from the watch, and re-add it, which then causes Xcode to not be able to run it anymore, which means I have to restart Xcode. What.)
So my question to more experienced devs is: what's your debug cycle when writing Apple Watch apps?
I'm running Xcode 12, watchOS 7.1, on Mac OS 10.15.7 (not Big Sur which may be some cause of issues)
Some steps that help for on device debugging:
To re-install the watch app, select the iPhone app in Xcode and build and run that. This will also re-build and re-install the watch app as needed.
Open the app manually on the watch
I still haven't figured out how to get a debugger or console, but for now my hack is to have a label on the watch that I use as my on device console.
This is almost certainly an Xcode 12 issue. At least since Xcode 12.5 my app has not worked with watch simulator (it can't connect to the phone simulator) and I get no debugger with a real device.
Using Xcode 12.3 seems to work.

Xcode 8 App installation failed, unknown error occured

The following error occurred when I tried to run a project on my iOS device. Running it on a simulator works fine.
The other weird thing is that I am able to run my other projects on my device, only this particular project that is giving me this error.
I tried all the solutions I'm able to find:
Cleaning the project, deleting derived data
Restarting Xcode, my Mac, and my iOS device
Deselect 'Automatically manage signing' in the testing Target.
I couldn't delete the app from my device and re-install it because it wasn't installed on my device before.
Any help would mean alot to me! I am using Xcode 8.1 with Swift 3.0, running on a iOS 10.1.1 device.
Close your Xcode completely from currently running on Dock
Unplug your iDevices cable at your Mac and plug again.
Open Xcode Again.
Clean,Build and Wait for indexing the device
Delete the previous app you install on your iDevice
Then install
If you have free Developer ID, make sure you got the Internet access
right on your iDevices.
Else,
Check your provision profile or certificates of your app that it's still available or not [Expire or not].
If expired, please create again.
Install those latest provision profile at your Xcode Preferences/Account/Detail/
Make sure Signing "Debug" and "Release" aren't empty
Close the Xcode(Completely quit from Dock) after you completed those steps
Open the Xcode again and do Clean,Build and Install
Hope this help.
Other alternative way,
Remove the app on the device and re-install
Change build version no and install again
Clean your the project and reattach your device
Do a pod update if you are using CocoaPods. This error can occur due to one of the pod libraries, device logs can be checked for the name of the library.
I get this error only on the second compile for device targets, and I've found that if I just modify one critical source code file by adding just an empty line, the error goes away and Xcode will compile again. The other way is to target a second device which isn't always convenient.
A way around this confusion is to add a an Xcode Run Script that basically does this for you.
Force Xcode 9 to recompile after a build seems to be file dependent also
touch ${SRCROOT}/MyProject/MySourceFile.swift exit $?
With the above script my issues went away, and I never saw the Xcode Alert again. This bug has been in several iterations of Xcode now.
I have the same problem too, and also tried all the solution like you. unfortunately, not solve this problem, but I copied my project to another path, the copied one can build on my phone successfully, hope this can help you.
It can happen if you have debugged the same app(bundle identifier) with more than one Apple Ids. Remove all accounts from Xcode and sign in to the one which you're currently working with.
Restart your Xcode & Uninstall your app.
Build & Clean your Project, now it working good.
this works for me
above is not working please Restart your system
This error message occurred when I was building on an iPhone 5 and an iPhone 6 Plus with Xcode 10. Build in iPhone 5s Simulator gave a different error: "App could not be installed at this time…/Notification Extension: No such file or directory"
Problem was resolved by check marking Target Membership in my Notification Extension's source file.

Invalid Device State - Xcode/iOS Simulator error

Problem: I cannot simulate an Apple watch interface. Whenever I try and test my Apple watch app on the iPhone 6 simulator, Xcode successfully finishes and builds the app, attempts at opening simulator and fails with an error message which reads 'Invalid Device State'.
I believe simulator has a watch simulator that opens along with the compatible iPhone simulator models that can communicate with Apple watch (example: iPhone 6) Although I have yet to see it work. I have built a universal interface for iPad and iPhone and another for the watch, so it's not a matter of the app being for the wrong device. Whenever I test on my actual iPhone I can test the universal interface successfully.
I'm using Xcode 6.2 on iMac OS X 10.10.3
I have tried restarting Xcode/Computer. I can't seem to find any other mention of 'Invalid Device State' anywhere, hopefully due to it being an obvious thing to avoid/fix that I've overlooked. Any help would be appreciated.
Force Quit xCode and restart will resolve problem.
I had come across this issue after updating Xcode 6.4 to 7.1.
Below are fixes for this :
Clean project (cmd+shift+k) as well as clean build folder
(cmd+shift+k+option)
Quit simulator and run again
Quit Xcode and Simulator and run again
Restart your Mac.
Solution 3 worked for me!
I had the same issue. Generally it is because you just update Xcode or change its name in the Applications folder.
If you just restart your computer it will work correctly.
Hope it helps !
I observed this happening when more than one Xcode app installed.
To fix this,
Launch Xcode and click preference..,
Go to "Location" Tab, Select correct options from "Command Line Tools" dropdown
Quit Xcode and relaunch it.
Run your app.
First of all, just clean the project.
Quit your project.
Quit your Xcode.
Restart Xcode.
This happens to me when I have two different Xcode versions running at the same time. Hopefully this helps you.
No need to quit, restart or even re-install. Switch to another iOS Simulator device (6s if you were using 6s plus) and voila!
Nothing worked for me on XCode 7.3.1.
Had to reinstall it to make the simulator work.
Go to applications folder. Drag drop XCode to Dustbin.
Empty dustbin contents.
Go to App Store and install XCode.
Run XCode. The simulator should work now.
I have Xcode 7.3 and Xcode 8.0 Installed.
If a am working with Xcode7.3 and opens Xcode8.0 to get some code from Xcode8.0 project.
When i run my application on Xcode7.3 So it will give me same error.
Solution is simple ForceQuit or Quit all Xcode's and open the required one.
In my case, the simulator would show an indefinite black screen whether attempting to run a project, or running the simulator directly (which should bring you to the simulated home screen). This would happen even on a newly created simulated device.
After the existing suggestions failed, the following worked for me:
Delete the Simulator
Delete XCode
Delete the Developer folder
Reinstall XCode from the app store. This requires attempting to run XCode again so that Mac OS will realize it's no longer installed.
Jus clean the project and restart Xcode. This happens to me when I have two diffent xcode versions running at the same time.
Robust fix is Just Quit your xcode and run again, hope so it will help you. This heck work for me.
On M1 Mac I've found more than 3 open simulators can cause this error. Quit the simulator app to fix this error.
I am pretty sure that in my case the simulator was corrupt after a failed language change.
Following this answer to reset the simulator worked.

Resources