Xcode: Creates a duplicated binary in .XCInstall after every build - xcode

I am on the latest Xcode (14.2). I am building an iPad app to run natively on the M1 Mac using "Designed for iPad". Problem is that on each build, Xcode creates a brand new binary (MyApp, MyApp1, MyApp2,....MyApp300...). These binaries are in /DerivedData/MyApp-xxxxxxxxxxxx/Build/Products/Debug-iphoneos/.XCInstall/
Any way to stop that? Building for iPad or the simulator doesn't do that.

I've been seeing the same thing, and it was chewing up my disk.
I created an empty new iOS project and saw the same thing; after the first run, each new Build & Run under "designed for iPad" created a new copy, in addition to updating the copy at the top level.
After more experimentation, I found that simply deleting the .XCInstall folder itself (as opposed to what I had been doing: deleting the files inside it) doesn't seem to create any problems, and build after build then occurs without the extra copy. I tried the same thing in my main project and it seems to have fixed it.
YMMV!

Related

ResearchKit.framework error: Image not found

I have an Objective-C app I wrote roughly 12 months ago, with the iOS Deployment target set to 12.1 . I added the ResearchKit framework to it, and during the time of development the app was working fine. What I do remember is that it only worked on an actual device and not on the simulator.
A year later Im back to make changes, using Xcode 11, and am now getting a familiar error, solution to which I cannot figure out. This is both on real device and simulator.
I have done all that is required to add the library. See attached images below:
TARGETS -> General Tab
TARGETS -> Build Phases
ERROR
Attempting to run on an iOS 12 device fails too. Is there something I'm missing?
I ended up removing the pre-build Research.framework and adding the full Project instead:
Remove the Pre-built ResearchKit.framework file, select Move to Trash when prompted.
Make sure the ResearchKit project is closed (if it's open it wont be added as a project but as a file)
Drag and drop the ResearchKit.xcodeproj project file, into destination project. After this make sure the ResearchKit project has its files under it.
Go to Main project file of your project (not ResearchKit) and select your Target.
Make sure ResearchKit.framework is listed under Embed Frameworks. If not, then add it by selecting the + button and selecting it from the list. If it is not on that list then build the ResearchKit project to create the .framework file.
Under the same Target, go to Build Phases, and make sure ResearchKit.Framework is added under Link Binary with Libraries, and also under Embed Frameworks. If not then add it where absent.
Build and run.
There may be better ways to resolve the issue, but for now this works for me to run the App. App now runs on simulator. However, an initial build takes up-to a minute because the ResearchKit project it pretty big.
Update: I later figured out that the reason why I was encountering the 'Image not found' error is that I was trying to run on simulator while the ResearchKit framework had been build to target arm64 (real device). You will have the same issue the other way around (attempting to run on device-arm64 while app was build for simulator).
So how do the above steps fix this? That fixes the issue because by having the ResearchKit project files included you get to build everything for the currently selected architecture, whether device, or simulator. Happy coding.

Recover xcode project from installed app on iPhone

I exedentaly deleted my xCode project, but I still have app installed on my iPhone. Is it somehow possible to retrieve at least some part of original project files from app itself?
No, it's not possible to do this.
You may be able to recover the original archive file created prior to installation on your device from inside the following directory (depending on how you deleted the original project) which may be of help.
~/Library/Developer/Xcode/Archives/

Prevent Xcode from keeping an old version of a project folder that I want to rename

I'm using Xcode Version 6.4 (6E35b)on a mid 2013 MacBook Air running OS X 10.10.5.
A few days ago, with my code in something of a tangle, Xcode crashed. After the crash, my app built and ran, but didn't do anything except eat memory at a fantastically fast rate.
I keep a git repository and every now and then a put a copy of the whole project folder on an offsite location.
I got one of my older versions out of storage, did a build and run and the same thing happened.
All copies of the same project (by name) now do the same thing. Run, eat memory, and nothing else.
I tried removing DerivedData, removing contents of /var/folders/, removing and replacing schema (in schema -> manage), removing all projects, emptying trash, and have removed Xcode (using "trash me") and reinstalling. No joy. Still the same thing.
I was wanting to change the name of the project anyhow, so I changed the name, and it works. Unfortunately, I can't seem to change the name of the folder containing the project. Using the file inspector, I'm able to change the names of almost everything, but info.plist wants to keep an extra copy of the old project folder name in it's path, as far as DerivedData and LLVM are concerned.
Right now I will continue working with the old project folder name, but new project name.
How do I make Xcode forget the old folder name?
As edited by John Caswell, the answer is basically covered by a careful reading of Duplicate and rename Xcode project & associated folders. I'm going to close this and resubmit the parts of the question that aren't answered.

Error: Xcode does not support opening folders without a project or workspace

I was trying to duplicate a project using this process Duplicate and rename Xcode project & associated folders
It wasn't working for me, so I deleted the duplicate folder. I'm reasonably sure I didn't delete the original project, or change any of its files or filenames. Now when trying to open the original project, I get the error
"Xcode does not support opening folders without a project or workspace."
I don't know what triggers Xcode to recognize something as a project. Any idea what I did?
Edited to ask a more specific question:
How can I open this existing project, and then do whatever needs to be done to make it usable?
The problem is that in Xcode 6.3, trying to rename a project causes a crash and leaves the project in an unusable state. That's a bug, of course, but it's not a very nice thing to do to the developer.
EDIT: Apple has just (secretly) released Xcode 6.3.2 GM seed, which is said to fix the crashing bug.
FURTHER EDIT: Xcode 6.3.2 final (not GM) really does appear to fix the crashing bug.

Corona Enterprise Xcode proj runs in simulator, but fails to archive "app_sign cannot resign <myapp>"

I'm at the point where I'm ready to build, but when I try to archive the project I get the following error in xcode:
app_sign cannot resign
/Users/me/Library/Developer/Xcode/DerivedData/My-App-bzgdaitstcabzpaiygqfnluetfhk/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/My-App.app/My
App. Please remove and then build
Does anyone know why this is happening?
In build settings I've tried leaving the code signing identity blank, and tried it with the correct distribution profile.
I've tried with and without the provisioning profile specified.
I've tried deleting the whole file in my DerivedData folder.
It would seem that this is the line in question that causes the problem:
"$TOOL_PATH" app_sign sign "$SHARED_RESOURCE_DIR/developerkey.cert"
"$CORONA_RESOURCE_CAR_PATH/resource.car" "$CORONA_EXECUTABLE_PATH"
little
But I don't know enough about what it's doing here to think of the solution. If I build the sample app that comes with Corona Enterprise still builds fine, but my own app still fails.
It turned out that the problem was to do with the xcode.proj file itself. Not sure what the cause was, it seemed to be keeping a reference to a file which no longer existed, rather than the new build.
I made a new project, copied all of my own source files across but left the new proj files in, and then it built successfully.

Resources