Xcode performance issue when compiling Swift - xcode

I have run app on simulator, then stop it and then I clicked Run button one more time.
I have not modified any files in the project just rerun it. But it takes the same time for compiling Swift files even in case I already built a project (5 - 7 mins).
What can be a problem?

Hit Run button then,
Goto "Report Navigator", within left panel of Xcode,
Select current build,
After selecting, within center panel you can see files getting complied one by one and you can identify which particular file is taking long time for compiling.
Or else if you wish to know, which particular function in your code is taking long time, I will advice you to go here.

Related

Recreate or recovering a VB6 project

I left VB6 and programming all together years ago, so pardon since I'm still dusting off what I remember.
I have an old program made for a friend in VB6 that he still runs in Windows Vista. He tried to update a label in the program and in trying to do the update, he has overwritten the project file where I used to see all forms and modules together.
Is there a way I can recover or recreate the project file as it was? All project files and modules are there, but when I open the VB6 project it shows only one form, that I can't compile or execute because it shows a "source not found"
I tried to go back to an old version of the project file with file recovery software but I couldn't find it.
Other way?
Practical steps to recover:
First and foremost: Back up what you have. Do this now.
Second, and only after the first, check (again) to see if you have a previous backup. Yes, this may seem pedantic, but, really, it's worth looking. Was that the only copy? Once you do all of this, consider creating a git repo for your code.
Third, in your empty project, simply right-click in the project explorer (Ctrl + R), and click "Add >" and then "Add Files...". Then, in the file input box, scroll down to the first file, hold down shift, and keep pressing the down arrow and all the files you want. Click "Open". Repeat if need be.
Finally, you need to re-add any dependencies. One way is simply to try to run the program with full compile (Ctrl + F5 or File | Run With Full Compile in the menus). If everything starts up, consider yourself fortunate. If not, you'll have to see each one that fails and add them back. This could be tedius, but just go through them one by one. In the Project menu, both "Components" and "References" can be gone through. Do this until the program successfully starts with full compile.
At this point, consider a making a backup. ;)

How do I reverse something broken on an iOS / XCode project? How do I tell Xcode, "Try it again, for the first time!"?

I have been working with an iOS application in Xcode and, until about an hour ago, was steadily improving the software, and making Time Machine backups every hour or two. Then, as mentioned at What is causing this secondary damage? , I broke something and the problem was alleged in old boilerplate code.
I thought that I would use Time Machine to restore a "last known good" checkpoint, but Time Machine said I didn't have permissions. So I manually copied the past two or so known good backups, and Xcode claimed identical build errors, in the same two lines of boilerplate project code.
It seems to me that Xcode stores more state than in the project directory itself.
Is there a way to get Xcode to forget it knows the syntax errors, let go of that state completely, and process the code as of the last checkpoint or two where things have been working?
I'd appreciate knowing how to reset whatever state is finding those syntax errors in old and new versions of the project.
Two options:
Quick: Xcode top menu bar > Product > Clean
Thorough:
Close your project, but not Xcode.
Xcode top menu bar > Windows > Organizer > Projects
Select your project in the left navigation bar.
Once selected, there should be a "Delete..." button on the far right, for "Derived Data" -- press it.
Re-open your project, let it index stuff, and try building again.
Also, I strongly recommend learning/using Source Control. Xcode has it built-in now!

Xcode 4.6.2 error: "cannot run on the selected destination"

I've been having this problem for a couple weeks now. All of a sudden this happened to my project and I havent been able to fix it. Its a basic tab-bar app and i've barely even started heavy coding on it. Running xcode 4.6.2 (tried on 4.6 and 4.6.1 also).
The actual error says:
"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."
Thanks in advance.
Well here's my new fix: I had (for some reason) changed the highlighted line below:
I had changed the ${EXECUTABLE_NAME} to something else. Changing it back did not fix the issue immediately: I had to first click the + to add a new row then delete the new row.
My app runs fine now
OLD FIX:
OK, so yes, it's true, there are other questions like this one. They helped me figure out a different (and stranger) solution.
I right-clicked on my .xcodeproj file and chose "Show Package Contents"
I then opened "project.pbxproj"
I copied all the text from it to another file, deleted all the text from it and saved
This "crashed" my XCode Project that I had accidentally left open in XCode.
I closed my project, then pasted the original contents of "project.pbxproj" back into "project.pbxproj"
I saved "project.pbxproj" and closed it
After opening my XCode Project again, I was able to run it on my device!
To me, it doesn't make sense why this worked because I didn't modify an files... But it did, so hurrah!
PS
Back up your project beforehand, just in case.
EDIT: Well mine has stopped working again and I can't use the above method to fix it...

Why does Xcode keep recompiling my untouched project?

I have an Xcode 4 workspace with several projects. Everything builds perfectly and works as expected, only Xcode recompiles files too often. If I hit the Build button, wait for the compilation to succeed and then hit the button again, shouldn’t that be essentialy a no-op, since no files have changed? Because my Xcode recompiles a big part of the project again. Even when I build and then immediately hit the Play button, I have to stare at the building process again. Is that neccessary, is it expected behaviour?
Shot in the dark, but do you have external xcode projects linked? XCode may be recompiling because it doesn't know the state of those projects.
Either way, you can always Run Without Building ^⌘R (control + command + r)
Are you executing custom scripts that change files before compilation? This will result that xcode will recompile all touched files even though maybe nothing changed.
You can turn this off by enabling a checkmark in the run script build phase. This will execute the script only on installation of the app.
The image below shows the actual checkmark.

Is there a trick to save time building in Xcode when there are thousands of images?

For testing the capabilities of an animation class I have created 5000 fullscreen images with 100kb size each. I added just 1000 of them to my project and Xcode is already building for 30 minutes now. The next time it would be nice if Xcode just uses the already alpha-premultiplied images from a previous build instead of stupidedly rebuilding everything. Any chance I can get that to work?
Add the build setting IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs to any target that doesn't want the PNGs modified. Here's how:
Go to your projects build settings.
In the lower left hand corner is a menu you icon that looks like a GEAR
Choose Add User-Defined Setting
Name the setting: IPHONE_OPTIMIZE_OPTIONS
Set the Value to: -skip-PNGs
Do a clean build and your good to go
The idea is to do this only after you've compiled your code once. This way, the images are correctly processed once, and then you don't need XCode to do it any longer. Credits go to this site.

Resources