Xcode tvOS requires Running Twice to Process Changes - xcode

I have been consistently running into this since Xcode 11 and it only happens with a tvOS project. The issue is that I run the code, make some changes, and then run again but the changes aren't incorporated into the build that is run. If I then run it again, they are. This means for each change I have to run the build twice. This even includes added debugger breakpoints. This occurs on an actual Apple TV but was not an issue prior. I do not have this issue at all for any iOS projects. Why are changes only being incorporated every other run?

Related

XCTest: How do I prevent Xcode from needlessly recompiling my project if I'm only making changes to my test Target

My Xcode project is very large, in terms of number of source files, and lines of code.
When I make a change to only the XCTest code, and hit run on a single test, a single test file, or even the whole test suite, Xcode re-compiles my host application first, even if no files have changed in the host application. It does so every time I make any change to any test file.
This is posing an efficiency challenge with writing tests, because small adjustments in the test code take a long time to re-run and re-validate. (upwards of 3 minutes per run - yes it's that big of a project, and we are already taking many steps to cut down the build time, by inspecting the build logs, etc...)
Using Xcode 10.3 with Swift 4.2
the tests are using:
#testable import MyModuleName
Is there a way I can prevent Xcode from re-building the whole project, if I've only changed tests?
I found the problem.
We have some custom scripts under the Project's Build Phases section that actually change some of the compilable assets in the codebase. We also have a Carthage dependency copy stage.
Commenting out both of these stages from Build phases makes it so that the whole project does not recompile when only changing tests. These scripts were actually making changes to the compilable code, making XCode force re-compilation.
Moral of the story: Check your build phases for any steps that could be modifying your source code, including possibly resource files that are part of the target. We will try to do this in a more automated way in the future, without having to comment out these build steps.

Nativescript sidekick error during cloud build

I am getting a strange error from sidekick cloud build since a few hours ago.
I was building the app successfully, but all of a sudden, it gives me the following error and even reversing the changes does not fix anything. I have even tried with a fully working version of my git repo.
[19-01-28 16:55:27.709] Build step started.
[19-01-28 16:55:37.465] (CLI) Unable to apply changes on device: a754d27bafb8bb273e444b9d6cefd370cd55f4d4. Error is: Build failed..
[19-01-28 16:55:37.469] Error detected during LiveSync on a754d27bafb8bb273e444b9d6cefd370cd55f4d4 for C:\Users\Afshar\Desktop\myapp. Error: Build failed.
I doesn't give me any more details about the issue.
I was wondering if anyone knows how to get more logs in cloud build or if this is a known issue?
Thanks
It happens with me as well for reasons unknown. I couldn't find any root cause, but I did notice one pattern. It usually happens when I am already running the app on an Android Emulator/Device.
When we execute tns run android --bundle, it listens for file changes after the first build and does some webpack incremental build thing afterwards, right?
At the same time, once Sidekick delivers a successful iOS build, it also starts listening for changes to do the webpack incremental builds on iOS.
So while we have these two LISTENERS active and we request for another iOS cloud build, before Sidekick communicates with the cloud, it modifies some files which the android listener detects and results in an incremental android build, which in turn modifies some other files, which the iOS listener detects, resulting in Sidekick trying to do the incremental iOS build but this time its stuck between giving you the incremental update and the new requested cloud build, so it throws you this LiveSync error.
Moral of the story: Try to request cloud builds, when these listeners are inactive.
I finally managed to solve it.
In case anyone else faces this issue, I tried the following command using a hint on this page and it solved the problem.
https://docs.nativescript.org/troubleshooting
tns platform remove ios
and then, I was able to build the project in sidekick.

Fabric doesn't show latest iPhone App build by Xcode(6.4)

My coworker set up the Xcode+Fabric environment before he left, and we have several old build shown in Fabric, which we were able to distribute to team members.
Now I did a new build (say build 21) within Xcode and I'm able to run with iPhone simulator and it indeed shows build 21 there. But when I open fabric from the menu bar I still only see the old build 20.
Is there an additional step I need to do to make build 21 show up within Fabric thus we can distribute this new version?
Many Thanks in advance.

Using UseHostCompilerIfAvailable=false makes VS to build already built projects over and over again

I have recently learned of the UseHostCompilerIfAvailable option. I have set it to false hoping it will stop intermittent build failures on VS part (which never occur when building with msbuild on the command line).
Well, builds do not fail, but now VS seems to completely ignore inter project dependencies. Meaning it always builds. Hitting the build button twice performs the same build over and over again.
Does anyone know how to use this option correctly?
Thanks.

What automated build system do Mac developers use?

my team is currently using buildbot to automate overnight and continuous-integration builds and regression tests. For builds and unit tests, the builder just invokes a script which syncs the sources from p4 and then runs xcodebuild. The regression tests are also launched by a shell script, and are themselves combinations of shell scripts and AppleScripts. The builds are all performed on one system but then buildbot triggers tests to happen on multiple Macs, with different architecture and OS combinations. The things I like about buildbot are the automatic triggers (so the tests run only if and when the build succeeds), and the reporting including the waterfall view to see the overall status.
However, I see a number of problems too. The "master" process which coordinates the builds is either leaky or just has a huge working set which means that it consumes a couple of gigabytes of memory. Occasionally network problems mean that a slave will be lost; rather than retrying later it will just fail the build. In fact if the slave is supposed to be triggered for a dependent build, it will fail the first build after it has otherwise successfully completed.
So what are the rest of you using to automate your Xcode builds and unit tests? How do those solutions work for you? Anything you would recommend?
I use TeamCity in a windows environment but I believe it will work on Mac and has xcode build agents.
Another similar question here.
Our team use Hudson with a script which converts the Unit Test output from XCode to NUnit format.
I know this is an older question, but for those using TFS to hold their Xcode projects, I created a custom build activity to make automating Xcode builds via TFS easier. The code is hosted on Codeplex here: http://tfsxcodebuild.codeplex.com/.
Hope someone finds it useful!
We worked out what was using all the memory - log files - older buildbot keeps all logs forever and keeps them in memory (possibly until a restart).
Newer buildbot can be configured to keep a fixed amount of history.
Buildbot build log files should be limited in size to avoid the problem.
I use the XcodeBuilder that's part of CruiseControl. Of course it helps that I wrote it. :)
But I did use it on a real multiple person project for an iPhone app (Surf) that's for sale in the app store.
Now that it's three years later I have my own answer to provide to this question. I'm using Jenkins, mainly for the plug-ins that it provides. It has a plug-in for building targets in Xcode projects (or schemes in workspaces). There's a plug-in to run the Clang static analyzer. It interfaces with my bug-tracker system, it'll automatically push builds to Testflight too.

Resources