With Xcode 4.3 views don't load - ios

I have several projects that with the upgrade to Xcode 4.3 don't crash but don't load their views either. Since it's a widespread problem, I wonder if I need to remake all the connections in the nib or some other global sort of change? I hope I didn't move to 4.3 too soon! Thanks

Amateur Hour: After upgrading to Xcode 4.3, my projects for some reason started opening with Xcode 3.2 Back to work!

I had a similar problem with Xcode 4.3; App windows were not loading after clean compiles. I found an apparent (so far) fix/workaround by deleting the failing app's folder within this folder:
~/Library/Saved Application State/.
In Terminal:
cd ~/Library/Saved\ Application\ State
(note the backslashes "\") Then delete the folder for the failing app:
rm -fr pgmname.savedState/
Or rename it:
mv pgmname.savedState/ z-pgmname.savedState/
Or maybe you can just rename it or trash it from Finder (I can't for some reason).

Related

Xcode 11.4 compile error 'Missing package product <package name>'

When I integrate a local package in my Xcode project everything is fine initially but when i switch branches and want to run the app Xcode gives me the compile error Missing package product <package name>. When I quit Xcode and re-open it everything is fine again. Any idea what this can be? An Xcode bug?
We also integrate external packages via Swift Package Manager which works perfectly fine. No issues there.
The issue is also well described in a post by Jesse Squires.
Solution 1: File > Swift Packages > Reset Package Caches
Solution 2: File > Swift Packages > Update to Latest Package Versions
For me, I needed File > Swift Packages > Reset Package Caches
In Xcode go to File > Swift Packages > Update to Latest Package Versions
Worked for me
In Xcode go to Product > Clean Build Folder
This worked for me. The problem originally started when I was trying to solve another issue that came up after I deleted my Derived Data folder.
Restarting Xcode didn't work, but cleaning the build folder did. I don't know if the other answers here would work for me because I didn't try them seeing as cleaning the build folder worked.
I bumped into this issue today on Xcode 13.0 when working on the WooCommerce iOS app after manually deleting the DerivedData folder.
The build was failing like in the questions description: Missing package product '<package name>'
I tried both resetting the packages cache and updating to the latest versions, but neither work. Thinking about it, that's not surprising since the packages Xcode couldn't find were local packages.
What did the trick for me was following this suggestion from an Apple forums thread and remove the local packages references, then adding them back again.
In WooCommerce's case, the local packages are part of a workspace file. Removing then adding them back again in the same order didn't result in a diff in the file. That is, nothing really changed in the workspace setup, but that was apparently the kind of kick Xcode needed to get over that error. 🤷‍♂️
I'm not sure of the root cause, but I get this quite regularly. Not the most elegant solution, but neither Reset Package Caches nor Update to Latest Package Versions worked for me. For me, I had to quit Xcode, and delete DerivedData.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then rebuild.
None of the answers worked for me on Xcode 12.5 beta. I had to manually remove all spm packages and re add them.
SPM - Reset Package Caches vs Update to Latest Package Versions
File -> Swift Packages -> Reset Package Caches
File -> Swift Packages -> Update to Latest Package Versions
Update to Latest Package Versions
fetch the latest possible version(based on restrictions)
Reset Package Caches
reset cache(derived folder) -> Update to Latest Package Versions
folder
<path_to_derived_data>/<randomizer>/SourcePackages/checkouts/<project_name>
//e.g
/Users/alex/Library/Developer/Xcode/DerivedData/SPM-dpsmlyjrashqjefkfheppizcrgic/SourcePackages/checkouts/SPMExperiments
[Local SPM]
I tried:
Clean project
Clean derived data
Resolve Package Versions (File > Package)
Update to Latest Package Versions (File > Package)
Restart Xcode
Restart Mac
And restarting the Mac is what worked 🥲
Others say doing "Resolve Package Versions" multiple times also work.
I got this error when having the same local Swift package open in two different instances of Xcode in two different projects. Got it working again by quitting Xcode and only having one project open at a time.
A workaround for me at the moment has been both running Product > Clean Build Folder (cmd-k) and then restarting Xcode. This is an issue in both Xcode 12.4 and 12.5, and 12.5's per user package caching did not resolve the issue.
File > Swift Packages > Reset Package Caches also appears to work but it is slower for me.
Context:
One of my vendors distributes their pre-compiled binary library via SPM. Whenever I switch between git development branches, I get:
"artifact of binary target 'xyz' failed extraction: The operation couldn’t be completed. (TSCBasic.StringError error 1.)"
It also causes these "missing package product" errors for totally unrelated packages presumably because if one package fails the whole SPM process fails ("resolving package graph failed") even if these package are entirely independent.
Edit: With Xcode 12.5 simply quitting Xcode and re-opening seems to be enough.
Start with the other answers like
Reset Package Caches
Product > Clean Build Folder
If this doesn't help...
In my messages I found a hint that I had a dependency to two different version of the same package.
After fixing this, Reset Package Caches suddenly worked for most of my packages.
I could fix the remaining problems by adding
platforms: [
.iOS(.v13),
],
to the corresponding package. Before that, I had no platforms statement.
Xcode Source Control should be enabled to run this.
Preference -> Source Control and enable the source control.
If none of the above answers work, Please refer the solution shared by GravityBytes in this link on Apple Forums.
Eventually he happened to share the below resolution
I eventually got this resolved. What seemed to get it working was re-adding my local packages using the "Add Packages…" menu option on the project that has the framework targets using the local package. This created a new "Packages" group in the project, and eventually started compiling correctly.
Please remove the existing references and try adding them using the above approach.
Just a silly question: did you set up your git account on Xcode preferences?
For Moya I had to edit project file to Xcode heart's content
/* XCRemoteSwiftPackageReference "Moya" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Moya/Moya";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 13.0.2;
};
anything other than 13.0.2 results in unresolutio for the numerous semicircular dependencies that Moya package brings to the table.
This breathes a new life into https://foldoc.org/field+circus
I had this issue after the current branch rename in the project and resolve it by clearing xcuserdata in workspace.
Nothing worked for me except Product -> Clean Build Folder and Restart
For me, Xcode was opened using Rosetta which wans't enabled before. Disabling Rosetta helped me 💪🏼
In Xcode 12.0.1 (12A7300) this bug has been fixed. It was auto-resolved by the Xcode update for me.
EDIT Xcode 12.5 [beta]
Apple added a SPM cache. See my question here. If you run into this problem with this Xcode version it might help to delete this cache.

Build operation failed without specifying any errors for React Native Xcode project

I have a React Native project that works fine most of the time(Android and iOS). But sometimes out of nowhere I receive this error when I am trying to build the Xcode project (Xcode or react-native run-ios):
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie)
processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
How do I solve this? Push to a branch on git, fresh clone, npm install, and all is working fine for a period. And after that the problem will repeat. Making fresh clones of project each time is a pain and takes long time. Is there another way or something that I don't know?
Maybe a some files that are in .gitignore is causing the problems, and after a fresh clone that solves the problem. This is the .gitignore file for my iOS project:
# Created by .ignore support plugin (hsz.mobi)
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
I had this same issue and it was fixed by deleting the contents of node_modules and doing a npm install in the parent folder.
I was faced with this problem too. And I noticed that my folder name was too long. I changed the project folder's name with the short one and this error gone. Try to change the project folder name.
It was really a time killer issue. I rebased the complete code base to a collegue's mac where it worked fine. After sparing more than a couple of morning hours I could find a solution.
Solution - Simply shorten your Project folder name (in mac).
This is undoubtedly irritating that its suggested to have longer and meaningful variable names but the folder name has to be this concise.
I had a issue with XCode 9.1 and iOS 11...
I solved this issue moving up my folder to another path, I know it doesn't make sense and is dumb but it really work for me. My project was at /Users/Me/Documents/MyProjectDir and I changed to /Users/Me/Desktop/MyProjectDir
What helped me was removing the ios/build folder in my React Native project, followed by rebuilding the project.
I highly recommend to run the build on console, to see if it outputs any other relevant information.
react-native run-ios --scheme "app-debug" # Or any aproppriate target
Read more about building+archiving from CLI here or try with other OSS tooling like fastlane.
For me it found bugs twice, that both were unrelated with the building process itself:
1) One was fixed rolling back to node v8 (LTS) apparently. It was very obscure, but I suspect had to do with having little memory available (running flow + packager + xcode + spotify + chrome on 8GB RAM MBP)
2) The other one was related to having a space on the xcode output. "App Canary.app" could not be installed. I figured it out doing ls ios/build/Build/products.... This error only happened after upgrading xcode, and wasn't happening with the release target, that did not have any whitespaces.
The only take away here is to run build directly on the console to debug further. You might find out things that are completely unrelated, and probably can't be solved by just removing the build folder.
Hope it helps.
Trashing ios/Build resolved this issue for me
In my case simulator is not shutdown correctly.
So I opened simulator manually again then I got an error that simulator is not shutdown correctly.So I relaunched the simulator successfully and built xcode project again. Error is resolved

How to Completely Uninstall Xcode and Clear All Settings

I have an issue that I can only assume is with Xcode, where my apps take forever to run and crash the phone/restart about 75% of the time. I tried using older versions of the code that I'd saved instead, but they had the same effect, which they didn't use to have about a month ago.
I've looked up every single possible way to solve this issue for the past few weeks have haven't found anything, so I want to completely uninstall Xcode and clear all settings; but I can't find a way to do this. I can uninstall it, but when I reinstall it, it still has all of my old settings and lists of projects etc. How can I completely uninstall it?
For complete removal old Xcode 7 you should remove
/Applications/Xcode.app
/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/Xcode
~/Library/Developer/Xcode
~/Library/Developer/CoreSimulator
For a complete removal of Xcode 10 delete the following:
/Applications/Xcode.app
~/Library/Caches/com.apple.dt.Xcode
~/Library/Developer
~/Library/MobileDevice
~/Library/Preferences/com.apple.dt.Xcode.plist
/Library/Preferences/com.apple.dt.Xcode.plist
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.bom
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.plist
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
/private/var/db/receipts/com.apple.pkg.Xcode.bom
But instead of 11, open up /private/var/in the Finder and search for "Xcode" to see all the 'dna' left behind... and selectively clean that out too. I would post the pathnames but they will include randomized folder names which will not be the same from my Mac to yours.
but if you don't want to lose all of your customizations, consider saving these files or folders before deleting anything:
~/Library/Developer/Xcode/UserData/CodeSnippets
~/Library/Developer/Xcode/UserData/FontAndColorThemes
~/Library/Developer/Xcode/UserData/KeyBindings
~/Library/Developer/Xcode/Templates
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/MobileDevice/Provisioning Profiles
Open Storage Management
Go to  > About This Mac > Window > Storage Management
Or, hit ⌘ + Space to open Spotlight and search for Storage Management.
Select Applications on left pane.
Right click on Xcode on the right pane and select delete.
This will remove XCode from the installed applications list of your Mac's App Store.
Update: This worked for me on macOS Sierra 10.12.1.
Before taking such drastic measures, quit Xcode and follow all the instructions here for cleaning out the caches:
How to Empty Caches and Clean All Targets Xcode 4
If that doesn't help, and you decide you really need a clean installation of Xcode, then, in addition to all of the stuff in that answer, trash the Xcode app itself, plus trash your ~/Library/Developer folder and your ~/Library/Preferences/com.apple.dt.Xcode.plist file. I think that should just about do it.
FOR UNINSTALLING AND THEN BEING ABLE TO REINSTALL XCODE 9 CORRECTLY
I followed the topmost answer for deleting Xcode 7 and found a major error, deleting ~/Library/Developer will delete an important folder called PrivateFrameworks, which will actually crash Xcode everytime you reinstall and force you to have to get your friends to send you the PrivateFrameworks folder again, a complete waste of time seeing if you needed to uninstall and reinstall Xcode urgently for immediate work purposes.
I have tried editing the topmost answer but see no changes so below is the modified steps you should take for Xcode 9:
Delete
/Applications/Xcode.app
~/Library/Preferences/com.apple.dt.* (Generally anything with com.apple.dt. as prefix is removable in the Preferences folder)
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/Xcode
Everything in
/Library/Developer directory except for
/Library/Developer/PrivateFrameworks
This answer should be more of a comment against Dawn Song's comment earlier, but since I don't have enough reputation, I'm going to write it as an answer.
According to the forum page
https://forums.developer.apple.com/thread/11313
"In general, you should never just delete the CoreSimulator/Devices directory yourself. If you really absolutely must, you need to make sure that the service is not runnign while you do that. eg:"
# Quit Xcode.app, Simulator.app, etc
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator
I definitely ran into this issue after deleting and reinstalling Xcode.
You might encounter a problem trying to connect the build to a simulator device. The thread also answers what to do in that case,
gem install snapshot
fastlane snapshot reset_simulators
Run this to find all instances of Xcode in your filesystem:
for i in find / -name Xcode -print; do echo $i; done

Malformed or corrupted AST file

I have a problem I don't know why did it happen in the first place but most probably because I've pressed move to trash to some system frameworks by mistake.
I got an error that says:
malformed or corrupted AST file: 'could not find file '/Users/username/myProject/QuartzCore.framework/Headers/CAMediaTiming.h' referenced by AST file'
I've tried to copy QuartzCore.framework in that Directory. It give me then a punch of new errors. Then if I remove the framework from the Dir. Everything will be good for the project till I make any code change. Then I would have to make the previous scenario again. It's very annoying now and I really need to fix this. Anyone?
As requested:
What caused this error for me (after getting the new Xcode) was I would try to run a project in simulator (accidentally in simulator, I never use simulator), but I'd forget to select my device or my device would become unplugged without me noticing, and it will try to run in simulator... so I would get those classic ".o" file errors... Then I would switch back to my device and get corrupt AST files...
To CURE the problem... (Follow the steps below VERY closely!!!!!)
Clean your project
QUIT Xcode (CMD+Q)
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/*
Reopen Xcode
MAKE SURE YOU HAVE YOUR DEVICE SELECTED AND NOT SIMULATOR
CLEAN project (Yes, again)
THEN build (to your device, not to simulator)...
Enjoy!
Note: After further experimentation I've found that the force-quitting of xCode is possibly not necessary.
In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.
Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.
...And now I can build again. Hooray! From terminal:
[sudo] rm -rf /var/folders/*
(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)
Additional clue: I could build with XCode-6-beta, but got the goofy "corrupted AST file" error in XCode-5.
In my situation, all I needed to do was click Product > Clean, then build the project again. It succeeded. Hope this helps some others who run into the same situation.
Hi all I got the same error because I have opened two projects at a time and drag and dropped frameworks from one project to another .
After some time I realised that this is not a right way. I moved all frameworks which are dragged from another project to trash. Then clean and run in simulator everything is working fine.
Delete frameworks->again add frameworks->clean and run
I hope it will help someone
Personnaly, just one solution worked for me:
In Xcode Go to Window -> Organizer
Clic on the "delete" button near the "derived data" directory.
Then Run again your project...
I just clean my project and re-build. Everything back to normal.
In my case, the error was happening because I had a corrupted .m file - it was one that had, somehow (not quite sure how) found its way into my project (I had Eclipse open at the same time and the corrupted file had some java code in it). To fix the problem, I cleaned my project, closed Xcode, deleted the erroneous .m file & re-opened Xcode. It then gave me a clang error due to the now missing .m file. I created a new, empty .m file with the same name and the project ran fine. Bit of a hack but it worked :-)

/developer directory is missing in Lion Xcode 4.3

I removed an older version of Xcode following the instructions in How to fully remove Xcode 4 and then installed version 4.3 from AppStore. But now /developer directory is missing.
I can find the same directory structure in /applications/xcode.app/contents/Developer/. Is /developer just a link to that directory and how can I create it again?
According to the XCode 4.3 release notes, the /developer directory is no longer needed.
/Developer No Longer Exists
The simplification afforded by repackaging
Xcode 4.3 as a single app bundle eliminates the need for the
/Developer directory containing prior versions of Xcode. As a result,
the Install Xcode application and the uninstall-devtools command line
script are also no longer needed.
The /Developer directory is no longer used by Xcode as jonkroll noted.
If you are looking for command line tools, you can install them using the Components tab of the Downloads preferences panel.
Yes you're right, now /Developer directory is embedded into XCode.app. So you have to make an alias to this new directory or change your path to this new folder.
One easy way to get to it is to right click on an existing framework that you have imported in your project; then choose "open in finder". Then you can hit option + the up arrow key on your key board to traverse up to the developer folder (e.g if you want to peruse the contents of your simulator documents folder etc...) & make a short cut to it for direct navigation..
Switching directories worked for me:
sudo xcode-select -switch /

Resources