Xcode Source Editor option not displayed in Extensions - xcode

Is there a way to activate Xcode Source Editor option in System Preferences > Extensions? For some reason, it's not showing on my Mac (the last option).

If the Xcode Source Editor is missing from the left pane (see image above), try one of these solutions before resorting to a reinstallation:
In the Applications folder, rename Xcode and then change the name back to Xcode, or move Xcode.app out of the Applications folder, then back in, as described by this Stack Overflow answer.
Move the Xcode app to the Trash and re-install it from the AppStore.

I install the Xcode manually that's why not found on Extensions.
To fix quickly:
Quit Xcode
Rename Xcode in the applications folder temporarily with any name.
Launch renamed Xcode
Quit Xcode
Name it back to the old value ("Xcode")
Go back to Extention you will find the Xcode

The entry is shown if the system detects that both Xcode and at least one Xcode extension is installed. Yet the code to detect Xcode has a few issues.
If you install Xcode first and don't have an extension, the entry is not shown. If you then install an extension, the system re-checks if Xcode is still installed and if yes, it should add the entry. However, the check code will fail in some situations. E.g. if you renamed Xcode.app to something like Xcode_13.4.app (as you need to manage different versions of Xcode), the detection code may not find it. It also may not find it if you moved Xcode to a different location outside of /Applications. And even if not renamed and still in the default location, the detection code sometimes fails and the exact reason why that happens is unknown (it may have issues with certain ownership, certain file permissions, case-sensitive file systems, etc.)
In all these situations, renaming Xcode causes it to be re-detected by the system and then the system sees that Xcode and at least an extension is installed and the entry appears immediately. No need to reboot or start the renamed Xcode; you rename it, you rename it back, and the entry is there and will stay there (even after deleting all extensions, it stayed on my system).
If you first installed any app with an extension and then Xcode, the problem does never appear as in that case you immediately trigger the rename-fix above, because the moment you install Xcode, the system will always detect it correctly (regardless how the app is named or where it is located or any other issue the scan code might have) and detecting Xcode and knowing there is an extension, the menu entry appears at once. The code that detects Xcode extensions seems to always work correctly.
This is probably one of the issues where the Xcode detection code has not been tested very well by the Apple but since it seems to work for the vast majority of users, Apple sees no reason to further investigate why it would sometimes fail.

It will get activated by default if any plugin are added in Xcode.
You have to download XcodeClangFormat plugin from GitHub and follow the installation steps. Then Xcode Source Editor will be visible automatically.
Please refer this link

Related

How do I find why Xcode no longer notarizes my app?

I have a MacOS app that I last notarized about a year ago with no issues. This time, however, when I created the initial Archive, the Organizer put it into a section called 'Other Items' instead of in the 'macOS Apps' section with all of the previous Archives. In addition, and more distressingly, when the Archive is selected, the button says 'Distribute Content' instead of the expected 'Distribute App', and pressing it simple exports the Archive or its contents, without running through the automatic notarizing process.
I suspect I have done something in the last year that somehow invalidates my app such that Xcode no longer recognizes that it is an app. I have followed the suggestions at https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, but that did not provide any relevant clues.
I am using Xcode Version 13.4.1. How do I figure out what is preventing Xcode from offering to notarize the app?
To track this down, I created a new project, and then tried to notarize it. (I didn't actually notarize it, I just made sure that I could Archive it and it showed up in the correct section in the Organizer.) The new project archived as expected, so I knew that I could still notarize somethings; I was just having an issue with my app.
My plan was to copy items from my app into the new project in small chunks, and after each copy, attempt to Archive it. I figured that I would either find the item that was causing the failure (and fix it), or I would eventually copy the entire app without a failure. Either way, I would be able to notarize the app.
The first chunk I copied was all of the build settings. And right there, the new project would not notarize, so I removed and added build settings to binary search which setting was causing the failure. It came down to the RUN_DOCUMENTATION_COMPILER = YES build setting.
In the last year I have been more conscientious about documenting the code, and to actually see that documentation, I had added that build setting.
Comparing the archives created with and without running the documentation compiler, the MyApp.doccarchive file appears in the archive in the Application folder along side MyApp.app, so it appears that Xcode is confused by the "extra" file in the Application folder.

How to clean junk files in Xcode from iOS support

I have tried cleaning the simulator but it again occupies 6gb disk space on my Mac.
Can anyone suggest manual cleaning?
If the objective is to free up disk space occupied by Xcode-related and simulator-related caches and data, and not just iOS support files, there are other folders you can look into to consider removing files, besides ~/Library/Developer/Xcode/iOS DeviceSupport/ and ~/Library/Developer/Xcode/DerivedData that have been mentioned in the other 2 answers so far.
~/Library/Developer/Xcode/Archives/ contains data from your builds that can be helpful in the process of symbolicating/debugging deployed apps, but could otherwise be removed. Thankfully, it is organized by date, so you can choose to keep specific folders inside it, and delete the rest
~/Library/Developer/CoreSimulator/ contains simulator related data. It includes a Caches folder and a Devices folder. If you no longer need to run your apps on certain devices, you may consider removing those devices' corresponding folders in the Devices folder. The Caches folder may grow over time as well, and you can remove contents from there, and they should be regenerated as needed.
If you've been using this machine for some years, it may be worth looking for ~/Library/Application Support/iPhone Simulator. The simulator related files used to be there until around Xcode 6. So you may have files still there that you might want to delete (I did, on some older Macs some years back)
There's an Xcode specific cache (not about simulators), ~/Library/Caches/com.apple.dt.Xcode, which should be regenerated as needed, but may be less useful to clean up.
You could also consider running DevCleaner from time to time to remove unnecessary Xcode-related files.
Delete the contents of "~/Library/Developer/Xcode/iOS DeviceSupport/".
Remove all "paired devices" in iOS settings > Developer.
Connect iPhone to the Mac and pick "Don't trust".
Since the above is not okay for iTunes syncing etc, try the following:
Delete the contents of the folder "~/Library/Developer/Xcode/iOS DeviceSupport/" and then right click > get info > lock the folder.
Locking the folder will stop Xcode from copying the simulator files from the iPhone to that folder next time you connect them.
https://apple.stackexchange.com/questions/380024/how-to-stop-xcode-downloading-ios-support-package-of-my-iphone
It is possible that Xcode starts downloading it via nsurlsessiod so you can block it either
by using a firewall
https://apple.stackexchange.com/questions/393689/how-to-stop-catalina-from-contacting-apple-servers-when-executing-programs/393698#393698
Or by renaming the binary as explained at the link below. (I haven't tried it)
Xcode simulator constantly download something
Command-Option-Shift-K to clean out the build folder. Even better, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually. Remove all its contents because there's a bug where Xcode will run an old version of your project that's in there somewhere
By following this steps you can do....
For user who are not able to find library/developer path.
open Xcode( i am using Xcode 13) -> file -> workspace setting -> there will be a path at center of modal -> click on arrow button next to path -> on clicking it will open up the folder.

Mac catalina xcode c++, access file pop_up

I use Xcode to write c++ programs. My programs contains
freopen("./input.txt", "r", stdin);
every time I change my code and click build and run, there is a pop-up that ask for permisson.
"cpp_binary" would like to access documents folder
This is just annoying as I change my code and rebuild frequently.
How can I bypass this annoying pop-up.
I have tried grant the cpp_binary full disk access right, but it seems that since I changed the code and rebuild, Mac catalina recognize the newly built binary as a different app, and it did not work.
The problem exists because I put my xcode project in documents foler.
After I move the project to ~ (/Users/myusername), the issue goes away.

This bundle is invalid. Apple is not currently accepting applications built with this version of the OS. (Mavericks)

I start by saying that I've installed Mavericks, I was curious to see the new features...
It was better to wait, because (apparently) there are no sensational changes.
Anyway, I'm trying to submit my app to the app store, but after a real hard fight with the code-signing, I have ended up with this message:
"This bundle is invalid. Apple is not currently accepting applications built with this version of the OS."
....From what I read, the only solution seems to uninstall Mavericks and go back to Mountain Lion, but I will be happy if someone else has got a alternative fix.
After some research on Internet I've found a fix for this problem.
1) Open "App Store" and leave it for now.
2) press cmd+shift+g on your desktop and go to /system/library/coreservices/
2) Copy SystemVersion.plist to your desktop, and duplicate the file
3) Open the file with the right name on your desktop, not the copy, and replace the old part with this:
<key>ProductBuildVersion</key>
<string>12E55</string>
<key>ProductCopyright</key>
<string>1983-2013 Apple Inc.</string>
<key>ProductName</key>
<string>Mac OS X</string>
<key>ProductUserVisibleVersion</key>
<string>10.8.4</string>
<key>ProductVersion</key>
<string>10.8.4</string>
4) Now copy this edited file to /system/library/coreservices, and go to "App store" application.
5) Download Xcode 4.6.3, now you can because your OsX is detected as Mountain Lion.
6) Once the download its finish, and Xcode installed, reboot.
7) Open your project in xcode 5 beta, if you have some .xib files, go in the file inspector, document versioning, and change development version to 4.6 instead of 5. Do this for each .xib, then close xcode 5
8) Open Xcode 4.6.3 and reopen your project. Check in the build settings that 10.9 is not present anywhere. Replace it with 10.8 or whatever you need.
9) Make clean, Build for archiving, Archive ... Cross your finger!
10) Your project should be validated now.
11) Once you uploaded your app, rename the SystemVersion.plist (copy) on your desktop, and copy it back to /system/library/coreservices. You don't need to reboot.
It's kinda a hack, but if you don't want to reinstall everything, it's the only way to go.
P.s: after replacing SystemVersion.plist, you will notice strange behaviors in the Os, like safari that isn't working and so on, that's why I suggested to duplicate the plist file, before changing the os version. Anyway if you can still use terminal and "vi" to restore everything, if for some reason you didn't copy the original.
Hope this will help someone. I've lost a day figuring out a solution ;)
Same problem with build 13A3017 on Mavericks
Switched it to 13A603 and it worked.
It's quicker to use this command in terminal and just make a note of the original build number to switch it back afterwards.
sudo nano /System/Library/CoreServices/SystemVersion.plist
but should probably make a copy of the file first just in case
I got this problem while I was using Mavericks 10.9.1 (build 13B40) and Xcode 5.1 dp. I finally solve the problem by:
Use Xcode 5.0.2 instead of Xcode 5.1 dp.
Go to /system/library/coreservices/ and modify the SystemVersion.plist using the copy/paste as #Benz 's answer. Thanks to #Benz
After copying and backing the SystemVersion.plist, modify the content as following:
mod ProductBuildVersion to 13A603, which is the build number of Mavericks 10.9.0 GM.
mod ProductUserVisibleVersion and ProductVersion to 10.9.0
Replace the SystemVersion.plist using the one you've modified.
Restart the Xcode.
Rebuild and achieve the app.
Submit.
Succeed!!!
Restore the SystemVersion.plist using the original file you've backed.
If you don't want to mass with the SystemVersion.plist, here is another way to get through it on 10.10:
After you made the archive, you can modify the .app bundle and .plist in the archive's root to match a valid accepting version. Then use the Xcode to submit it. No need to mass with the code signing or Application Loader.
If you want a simple solution and don't mind to pay for it, I've created a tool to do it with ease: https://vox.vg/xcarchiver/

XCode 4.5.2: Cannot run on the selected destination - Facebook SDK

Cannot run on the selected destination
The selected destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software.
I am using the Facebook-iOS-SDK from GitHub: https://github.com/facebook/facebook-ios-sdk
tested latest commit (2a030e795aed343e7614e149a5ebdfa78b223a72) and sdk-version-3.0.8 tag, both having the same problem. Tested the Hackbook, Scrumptious, FriendPickerSample on both iDevices and iSimulator.
It was working before (on older version of XCode), so it could be the xcode upgrade, but my other projects work fine. I've tried multiple solutions on this site which works for others but not on mine, does anyone encounter this before with Facebook-SDK specifically? Thanks in advance!
EDIT: I have found the issue, if you install the FacebookSDK and you add the resources folder to get the facebook image buttons there is a Info.plist file. XCodes goes weird with this info.plist file. I have deleted it, made a clean and now it works perfect :)
OLD:
The same behavior here. On another projects it runs perfectly but in this one I have always the same problem. After some XCode restarts sometimes it runs ok, sometimes I "click" on run and then nothings happens, sometimes it runs...
The best option is to move the project to other path. Adding and removing the libsql3.0 from lib dependencies sometimes works too.
Sadly, it seems like this is a bug on XCode, it will build and run fine for once every couple of restarts and with the entire project directory moved to other path. This is very sad because apple always make good products for consumer but all their developer software are crappy compared to big M's
I ran into this problem. It seemed to start right after XCode hung and I had to force quit. This was a day before the 4.6 update. I hoped that that update might fix the problem. And I did get one successful build before I started getting that message (actually in 4.6 there are two different but similar messages that seem to alternate.
I solve the problem by letting XCode update the project settings. I first noticed this possibility when I made a duplicate copy of my project and open that, but it is clear that this option is also available in the original. Here is what I did
In the Issues Navigator just under my project "MyProject project" I had a message MyProject.xcode
Validate Project Settings
Update to recommended settings.
I click on that and I was presented with a dialog box with 4 checkboxes some explanatory text and the option to perform changes. I just let Xcode make those changes and everything has been fine since.
Remove info.plist from Facebook Resources folder. Changed the location of XCode project and Reset the iPhone simulator...now it is working :) Buggy XCode !!

Resources