Xcode 9.3 and update to High Sierra: Instruments can't open *.tracetemplate files even after full reinstall - ios

With the last update of Xcode to 9.3 running on High Sierra, I realized that Instruments is not working any more.
When I try to open it from inside Xcode using Open Developer Tool > Instruments, I can see the template chooser dialog but as soon I pick one, a dialog appears:
The document "Allocations.tracetemplate" could not be opened. Instruments cannot open files of this type.
Allocations.tracetemplate could not be handled because Instruments cannot open files of this type.
This happens with all templates.
I already tried to reinstall Xcode completely. Before I deleted all files like described here: How to Completely Uninstall Xcode and Clear All Settings
I also tried to use
sudo chmod a+rwxt /Library/Caches/com.apple.dt.instruments
(Xcode 6.3.2: Instruments keep asking for trace template?)
but this file does not exist on my computer.
I also installed Xcode 9.4 beta 1 but that didn't solve the issue either.
I also can't find these template files like Allocations.tracetemplate anywhere on my computer.
Any help would be very appreciated ;-)

I still had some old Developer Tools on the HD. Removed following things and it worked again:
~/Library/Application Support/Instruments
everything I found in /Developer/ vaguely attached to Instruments
especially "3.0/Instruments/
and the old Instruments.app
also defaults delete com.apple.dt.Instruments in Terminal

Related

Xcode 13.2.1 Preview Not Working but Simulator Works

My Xcode Version 13.2.1 (13C100) got an unknown issue. I did several things like delete Xcode, new install Xcode, restore from backup nothing make any change! Currently, the project can be built and run in the simulator, but not in the preview window! it gives a message:
Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds.
What is the issue here any idea?
iMac becomes very slow when I taped the resume button.
Please Help!
I had a similar problem and was solved when I turned of Automatically refresh canvas
Suddenly It fixed, maybe the last update from apple through a software update called "Command Line Tools for Xcode". Before I have also tried a fresh OSX installation but the issue has not gone at all.
Check Software Update from system preference.
Thanks to the great community.
Try the following:
Clicking on the "Diagnostics" button on the failed preview pane.
Copy the ".pcm" file path. It looks like something similar to "/var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm"
Run the following command to remove the .pcm file in the Terminal app (replace the path using the specific path you copied from the Diagnostics log obtained in the step above:
rm -rf /var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm
References:
https://support.macincloud.com/support/solutions/articles/8000098646
https://developer.apple.com/forums/thread/696908
For me, it worked when I changed the device to Any iOS Device(Arm 64) for the preview
on a Mac with apple silicon chip
CTRL + Click on Xcode app
Get info
Check "open using Rosetta"
I had the same problem:
No preview with diagnostic : "Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds".
Tried the solutions found on the internet, without success.
I switched to macOS beta 12.3 and Xcode 13.2.
And now there is the preview...
The below solution has worked for me:
Running a preview for a project having scenedelegate or appdelegate which worked and then i tried running preview for app protocol style project which was not working earlier.

Xcode won't run app on simulator

Yesterday I uninstalled my App Store install of XCode and installed it manually from the Apple developer site.
I had 9.4.1 and downloaded 9.3
Ever since I've not been able to run any apps on the simulator.
I see the following error in xcode:
I see this error in the Xcode logs:
iOSSimulator: 56E6A4AD-4D6F-4CB4-A666-E1DE0D49B101: Failed to launch app with identifier: com.mikevelu.Test and options: {
"activate_suspended" = 0;
arguments = (
);
environment = {
"DYLD_FRAMEWORK_PATH" = "/Users/mikemurray/Library/Developer/Xcode/DerivedData/Test-fqvnwaelkrhrooepamzxmakiidkf/Build/Products/Debug-iphonesimulator";
"DYLD_INSERT_LIBRARIES" = "/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Develope<…>
and I see this error in the simulator logs:
(UIKitApplication:com.mikevelu.Test[0xf61e][2808][2983]): Service could not initialize: 99Z999: xpcproxy_sim + 9282 [1524][AF02A7E2-099C-3F21-AB91-5AA7DB3FFA58]: 0x5
I've tried the usual culprits, removing derived data/cleaning build folder/restarting simulator/restarting xcode/restarting macbook.
I've also tried completely uninstalling xcode and reinstalling (uninstalled 9.3 and tried installing 9.4.1), doesn't seem to make any difference.
Seen a few similar questions posted and one of the most common fixes seems to be removing any checked blank environment variables in the scheme, I can't find any to remove. I've tried running both in debug and release, I've tried disabling Debug executable and selecting the executable on launch. Also tried deleting the scheme and creating a new one.
Also set verbose logging on the simulator and I didn't get any more illuminating information.
If if install the app manually using simctl and launch it using simctl it will launch without complaints (that's what prompted me to try disabling debug executable).
I see this issue regardless of which project/workspace I have open in Xcode, the example I'm using currently is just a blank project I created to try and get to the bottom of the issue.
I'm edging closer and closer to a complete restore being the most logical next step, but I'd like to avoid that if possible.
*EDIT - Discovered the issue was with anti virus not liking it when xcode wasn't named Xcode.app. Sigh.
So, it looks like renaming the Xcode.app file now leads to some pretty ropey behaviour.
Up till now when managing multiple installs of xcode I'd just rename the files to something like Xcode.9.4.1.app, not sure when/if that's changed but the only way I can fix the simulator issue is to keep the Xcode.app filename.

Xcode Beta 7 Simulator hung on Apple or standard screen, cannot load up my app

I tried to create two view controllers with a segue (just static pngs for now) just to test a build.
Either screen is all black or I get the standard Apple screen (just the regular icons), but don't see my build as a placeholder icon.
I already tried following these recommendations from the Apple Developer Forum and still see no solution. =/
Reinstall the Xcode beta
rm -rf ~/Library/Developer/Xcode/DerivedData
Open Xcode and delete all the simulators using the Window > Devices window
Take a backup of ~/Library/Developer/CoreSimulator/Devices/device_set.plist and then remove the com.apple.CoreSimulator.SimRuntime.iOS-9-0 key. Xcode doesn't seem to put this back so I don't know what else this might break.
Reinstall simulators within Xcode using the + in the lower-left of Window > Devices.
You should not be modifying ~/Library/Developer/CoreSimulator/Devices yourself. Chances are CoreSimulatorService was running at the time you did that, so you basically changed state out from underneath it. Where was that recommended to you? I'd like to comment in that thread so as to not let that information stand.
If you want to erase a device back to its default state, you can use xcrun simctl erase <UDID> or just choose the menu item in Simulator.
Now as to your initial problem, when you click on Build & Run, Xcode will install the application and then launch it for you. If you're not seeing it even install, then there's possibly something going wrong with install. I suggest you take a look at your device's system.log to see if installation was requested by CoreSimulatorBridge. If it was, then look for additional log lines that might indicate the failure reason. If it wasn't, then the issue is on the Xcode side.
Either way, you should file a radar at http://bugreport.apple.com including ~/Library/Logs/CoreSimulator/*.log ~/Library/Logs/CoreSimulator/[UDID]/system.log and a sysdiagnose taken when the issue is reproducing.

Xcode will run app on simulator but not on device

I receive the following error when trying to run the app on my device.
error: failed to launch '/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor' -- No such file or directory (/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor)
The app runs fine in the simulator. When I try to debug on the device, it appears to copy the app (I can see the icon), but then stalls with the above message. Xcode says it is running the app on my iPod, but nothing is happening on my iPod.
When I click on the app, the app appears to launch, but seems to be missing resources.
Other projects of mine work properly. What setting do I need to change to make this work properly.? Looking at the error message, it seems to be looking in my mac for the app. But this doesn't make sense since I am trying to run it on my 4th gen iPod touch. I am using Xcode 4.3.1 and iOS 5.1
With Mountain Lion and the latest version of Xcode (4.4.4F250), none of the suggestions in this thread worked directly (clean, clean project, remove derived data folder, etc). This sequence did. From DhilipSiva:
Disconnect your device
Delete the app from your device
Quit Xcode (Don't just simply close the window, quit it)
Delete derived data folder rm -fr ~/Library/Developer/Xcode/DerivedData (console)
Start Xcode,connect device & run the project
I solve this by going to Targets-> Info -> Required Device capabilities and delete the option with armv7.
Hope this helps!
This is a recurring problem that many developers are having with the current version of Xcode. The temporary workaround has been consistently deleting the DerivedData folder.
You can add doing it to a build script or even make it a cron job:
rm -rf ~/Library/Developer/Xcode/DerivedData
Sad, but true.
For me restarting of Xcode, cleaning DerivedData and restaring device wasn't enough in most cases, until I had figured out that iTunes was also running, and after quitting iTunes everything worked fine!
So my steps now are simple:
1. Quit Xcode.
2. If iTunes is running, quit iTunes.
3. Reopen project.
No need to remove app from the device, clean project or restart/disconnect device.
I think that's because Xcode and iTunes use some common libraries (as you know, Xcode Installer always asks to quit iTunes on installing iOS SDK).
I also had this problem after changing from a lower XCode and iOS version to the current XCode and iOS version.
I fixed this problem by changing th iOS Depolyment Target to a lower version, since my Device is not updated to the latest iOS yet.
You can do this by clicking the project inside the Info tab.
Have you looked at the Developer Certs and Distribution Certs if you have. When running in debug mode from Xcode your will need your app assigned with the developer cert and not the distribution cert. The distribution certs do not allow for debugging.
This error will manifest whenever the device capabilities described in the Info.plist do not match those of the device.
In my case, I was requesting GPS support and location-services support and trying to test on an iPod touch.
I struggled with this problem for 2 days and went through all the posts, tried all the options including, restarting Xcode, device, deleting DerivedData folder etc.
Finally, the problem was with the Info.plist file. In my case, I had improper icon paths in the Info.plist file. I suggest you to archive the application and then validate it to get the exact problem in you case. Only when I did that, I was able to find the issue.
I solved this problem many times with DhilipSiva's solution. However, it may not work sometimes. If that is the case, consider deleting and re-adding the target.
Removed armv6 support and it started working again
I stumbled upon this same problem on several diferent projects, researched a lot on forums and even here on Stack overflow. A lot of solutions were given, and some people seemed to get them working, but none of them worked for me.
So we tried some pretty obvious course of action, which for some reason we didn't tought about before: I've done a CHMOD -R 777 on the EXACT path indicated by the error message (I copied it directly).
Worked like a charm, 100% times!
Hope it helps, guys!
As Chronos mentiod, the device capabilities might be the reason. In addition I would say that in my case it was all about the UIRequiresPersistentWiFi key, which (for some unclear reason) didn't let me to install my app on an iPhone4. Hope this helps ones who tried everything else and haven't fixed the problem yet.
I solve this by going to Targets-> Info -> Required Device capabilities and check id at 0 index if armv7 not in 0 index then remove other things and armv7 set on 0 index and clean app connect device and run.
Hope this helps fine!
I did these steps:
Delete derived data: rm -rf ~/Library/Developer/Xcode/DerivedData
Deep cleaned the project: Shift Key + Option Key + Command Key + letter K key
Quit the project
Quit XCode
Deleted the app from my device
When I reopened the Xcode, launched the project, and then launched the app it successively ran on my device
For me it was Command Line Tools
Go to Xcode -> Preferences -> Locations -> Command Line Tools
Make sure you select latest Xcode version. I selected Xcode 11.0, and everything started working.
I get the similar question and has searched via the internet the whole day without solution yet...
Xcode 12, iOS 14.
I'm using a cocoaPods call GCDWebServer, which will open a build-in http service in iOS. Now it works fine in simulator and I could open a home page of it in my Mac's browser. But I cannot open the home page if running it with real iPhone. The browser said "Cannot connect to server"
And in console, everything is same without any errors provided for me.
Thus, how could I debug this?
[DEBUG] Did open IPv4 listening socket 3
[DEBUG] Did open IPv6 listening socket 4
[INFO] GCDWebUploader started on port 80 and reachable at http://192.168.1.3/

Xcode 4 Crashes frequently

I just downloaded XCode 4 on my Mac Air running Snow Leopard. It crashes all the time! I believe I can recreate the issue most every time by following these steps:
Hold Option key and click on an Object/Method etc. to open documentation.
I am presented with a login screen to enter my Apple Dev Credentials but an error dialog appears.
Click 'Continue'
I get the documentation
Debug application
A dialog appears telling my XCode has crashed.. Game over
This is happening on my Mac i5 as well as my Mac Air. It crashes frequently enough that it is almost unusable. Is there a workaround that anyone has found?
Holy cow.. how did this ship? :)
Thanks!
I got it resolved! So as it turns out the documentation is not installed by default when doing a clean install of XCode4. So I installed it locally and my issues went away. Heres what I did:
Go to Xcode preferences
Click "Downloads"
Click the "Documentation" tab
Install the Documentation (I just installed it all)
Restart xcode (I noticed the documentation would not open till I did this)
Now when I visit the documentation I do not get directed to online documentation and the crashing is gone.

Resources