Mac iCloud alters Xcode Pods breaking my build - xcode

Every couple days to couple weeks I am unable to build my project because Xcode states
"Use of unresolved identifier 'Fabric'
This also happens with Crashlytics
Now I've narrowed the bug down to some situation in my Pod Folder. To initially fix this I have to delete both Fabric and Crashlytics from the Pod file. Then do a pod install/update.
So the cause of this is, right beside my Fabric and Crashlytics folders there is a little cloud icon. I assume this is iCloud and it is changing my folders at what appears to be random intervals. How can I unhook these folders from the iCloud?
Or stop iCloud from breaking these folders/pods?
I found the meaning of this icon
It means that the file is stored only in the cloud and not on your computer.
Not sure why this behaviour is active on only these two pods.
New Update, I swear this failed before but clicking the cloud downloaded the file from the cloud for me and allowed me to build.

Edit: Add an empty file called .nosync and iCloud will ignore that directory and all of its subdirectories.
It seems like you're syncing your desktop and documents folders with iCloud Drive. The easiest way would be to move your Xcode project to another directory.
Maybe look into iCloud having an ignore list that makes it omit certain files.
You can also add pre-build actions to delete and redownload your pods in the scheme editor menu. This GitHub Repo explains what I'm talking about.

It seems you are storing your Xcode project and Pods folder into a folder syncing to iCloud (which could be Desktop or Documents folder).
The problem might occur for a number of reasons and I'd bet it's the syncing mechanism getting stressed by the build/pods system.
To address the issue:
create a folder "Development" in your User folder (for example /Users/Charles/Development) -> this folder will not be synced with iCloud
move your project to the Development folder
drag the folder to the Finder sidebar for easy access
if you were using iCloud to share the project across multiple Mac, go to BitBucket/GitHub and use a git repository instead. If you don't want to use Git but fancy cloud sync, use Dropbox or disable Mac storage optimisation in iCloud Drive settings

Related

Can Xcode SDKs (such as watchOS and tvOS) be uninstalled?

I have installed Xcode in my machine in order to use it for desktop development (OS X/Cocoa/Command line tools). Whenever I create a new project, there are templates in the wizard for iOS, watchOS and tvOS development, but at this moment I have no interest in these SDKs.
Since Xcode.app is taking a lot of space in my disk even after a fresh install, is it possible to remove these SDKs and reclaim some space?
I found out how to do this. I don't know at this moment if this can have any side-effect on other components for Xcode that could fail. In that case it may be possible to reinstall it from the Mac AppStore again.
Xcode packages the SDKs for these different products as Platforms. There is a Platform for macOS, a Platform for iOS, and so on. All these Platforms are stored in this folder:
/Applications/Xcode.app/Contents/Developer/Platforms
It seems it's possible to actually remove platforms by deleting the correspondent folders inside, such as:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform
Whenever one or more of these folders are deleted, the New Project wizard won't even show them anymore as categories.
Above in incorrect. You will have to reinstall Xcode if you delete any of these folders. /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform I deleted above Xcode wanted me to reinstall.
Try to delete all folders besides "developer" inside platform folders.
Example, delete all beside this:
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/developer.
Other folders in that area you can delete

What can I delete from ~/Library/Developer/Xcode folder?

My ~/Library/Developer/Xcode folder is over 17 gigs in size. As I work in virtual machine (Parallels 12) with a 64 gig limit in total virtual disk size, I need to recover some disk space.
Amongst the folders such as:
Archives
DerivedData
Installs
iOS Device Logs
iOS DeviceSupport
Snapshots
UserData
What might I be able to delete without ruining my project?
Under Archives you can delete anything you want but you should keep recent builds. And you should backup older builds you might need to access in the future.
You can delete everything under DerivedData. Next time you build a project, the needed files will be recreated.
My Installs folder only contains a set of empty folders and the newest if over 3 years old. Check yours, that may be safe to delete.
The iOS Device Logs folder contains old device logs for various versions of iOS. You can safely delete any of the older logs.
The iOS DeviceSupport folder contains a folder for each version of iOS you ever had on an iOS device you ever connected while Xcode was running. Feel free to delete any folders for versions of iOS you don't support anymore. For example, if none of your apps have a Deployment Target older than iOS 8.1, for example, you can safely delete any folder for iOS 8.0.x and earlier. These folders are only needed to symbolicate crash reports.
The Snapshots folder is used by Xcode to save snapshots (backups). You can delete snapshots for old projects you don't care about.
I'd leave the UserData folder alone.
Here is explantation for each folder and what you can delete to reduce the size.
DeviceSupport - You can keep the simulator which log's you may need in future. It's symbolicate crash logs for different device/iOS.
Delete this folder after every few days interval. Most of the time, it occupy huge space!
~/Library/Developer/Xcode/DerivedData
All your targets are kept in the archived form in Archives folder. Before you decide to delete contents of this folder, here is a warning - if you want to be able to debug deployed versions of your App, you shouldn’t delete the archives. Xcode will manage of archives and creates new file when new build is archived.
~/Library/Developer/Xcode/Archives
iOS Device Support folder creates a subfolder with the device version as an identifier when you attach the device. Most of the time it’s just old stuff. Keep the latest version and rest of them can be deleted (if you don’t have an app that runs on 5.1.1, there’s no reason to keep the 5.1.1 directory/directories). If you really don't need these, delete. But we should keep a few although we test app from device mostly.
~/Library/Developer/Xcode/iOS DeviceSupport
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; that's where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. As it is user data, no big issue if you delete it completely but it’s safer to use ‘Reset Content and Settings’ option from the menu to delete all of your app data in a Simulator.
~/Library/Developer/CoreSimulator
(Here's a handy shell command for step 5: xcrun simctl delete unavailable)
Caches are always safe to delete since they will be recreated as necessary. This isn’t a directory; it’s a file of kind Xcode Project. Delete away!
~/Library/Caches/com.apple.dt.Xcode

Foundation.framework icon red, and the path is incorrect for Cocoapod due to Xcode 8 Beta. I know the proper path, but can't set it

The path for Foundation.framework is pointing to:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework
It does not exist. The only thing I need to change is /iPhoneOS9.3.sdk/ to /iPhoneOS10.0.sdk/, but when I click on the "change path" from Xcode, I cannot get access to the Xcode-beta.app by right clicking and doing show package contents. I couldn't find a way to do it programmatically within any of my files either, how could I fix this?
This is for the firebase SDK.
Whenever I have any red files related to 3rd party dependencies instead of checking paths in Build Phases and Build Settings etc I often delete all pods folders and podconfig files and run pod install again from the Terminal. Then I clean and Build and usually all is good. It's much quicker and will likely fix other problems you aren't aware of yet because there could be pod updates you've missed as well.

Xcode 7.3 taking too much space [duplicate]

After going through and cleaning my disk with old things that I didn't need anymore, I came across the iOS DeviceSupport folder in ~/Library/Developer/Xcode which was taking nearly 20 GB.
A similar question has been asked before, but since then many things have changed and I would like an up-to-date answer.
As long as I have the version I use for testing, can I delete the older/unused versions without breaking anything?
The ~/Library/Developer/Xcode/iOS DeviceSupport folder is basically only needed to symbolicate crash logs.
You could completely purge the entire folder. Of course the next time you connect one of your devices, Xcode would redownload the symbol data from the device.
I clean out that folder once a year or so by deleting folders for versions of iOS I no longer support or expect to ever have to symbolicate a crash log for.
More Suggestive answer supporting rmaddy's answer as our primary purpose is to delete unnecessary file and folder:
Delete this folder after every few days interval. Most of the time, it occupy huge space!
~/Library/Developer/Xcode/DerivedData
All your targets are kept in the archived form in Archives folder. Before you decide to delete contents of this folder, here is a warning - if you want to be able to debug deployed versions of your App, you shouldn’t delete the archives. Xcode will manage of archives and creates new file when new build is archived.
~/Library/Developer/Xcode/Archives
iOS Device Support folder creates a subfolder with the device version as an identifier when you attach the device. Most of the time it’s just old stuff. Keep the latest version and rest of them can be deleted (if you don’t have an app that runs on 5.1.1, there’s no reason to keep the 5.1.1 directory/directories). If you really don't need these, delete. But we should keep a few although we test app from device mostly.
~/Library/Developer/Xcode/iOS DeviceSupport
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; that's where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. As it is user data, no big issue if you delete it completely but it’s safer to use ‘Reset Content and Settings’ option from the menu to delete all of your app data in a Simulator.
~/Library/Developer/CoreSimulator
(Here's a handy shell command for step 5: xcrun simctl delete unavailable )
Caches are always safe to delete since they will be recreated as necessary. This isn’t a directory; it’s a file of kind Xcode Project. Delete away!
~/Library/Caches/com.apple.dt.Xcode
Additionally, Apple iOS device automatically syncs specific files and settings to your Mac every time they are connected to your Mac machine. To be on safe side, it’s wise to use Devices pane of iTunes preferences to delete older backups; you should be retaining your most recent back-ups off course.
~/Library/Application Support/MobileSync/Backup
Source: https://ajithrnayak.com/post/95441624221/xcode-users-can-free-up-space-on-your-mac
I got back about 40GB!
I wrote a small command-line utility based on the great answer by #JamshedAlam for those who are tired of deleting the contents of those folders manually. Check it out here if you think it would help you.
Yes, you can delete data from iOS device support by the symbols of the operating system, one for each version for each architecture. It's used for debugging.
If you don't need to support those devices any more, you can delete the directory without ill effect

Bundled content in an app store app

I am trying to get my app submitted to the mac app store and I am having a bit of a design problem. Our app is an authoring tool and comes bundled with many projects created with the tool. Before the time of the app store, we would ship our app as an .img file which contianed a project directory and our app. Since I am only going to be submitting the .app file to the app store
with my app I am wondering where I should but the projects directory.
Initially I tried to put the projects directory inside of the bundle but this will not work because it is possible for the user to make changes to projects which might add new files to the project directory and this would make the sandboxing unhappy and mark the app as invalid.
What is the correct place to store such resources? I assume they should go inside the container? If so, what would be an elagent way to deploy this projects directory? Since we do not have installers in Apple land what would be the best place to deploy this projects directory? Do I just need to check on app launch if the projects are present and if not copy them from the bundle? This seems wrong.
Do I just need to check on app launch of the projects are present and if not copy them from the bundle?
Actually, this sounds right to me. As you said, the user cannot change/add any files in the app bundle. If you have resources there that the user needs to interact with, I would copy them to the ~/Library/Application Support/MyApp/ folder when they are needed. The user can then interact with the files from that location. (When sandboxed they go into a different but related location.)
I don't really know what your app does, but it would also seem like a possibly useful feature to "reset" the project files/folders back to a starting state. So copying the files in this way would allow for that kind of behavior as well.

Resources