title: Generating .gcda files after running unit tests on Xcode bot
body: <p>I would like to know how I can generate gcda files when an iOS application is running unit tests on an Xcode bot.</p>
  
  <p>I used <a href="http://qualitycoding.org/ios-7-code-coverage/" rel="nofollow noreferrer">this blog</a> to configure Xcode to generate test coverage files and generate a report using a script that utilizes lcov. I can consistently create the coverage files and the report on my development computer but when the bot attempts the same process, no .gcda files appear. When calling <code>__gcov_flush()</code> on the bot, I can see the following error in the log:</p>
  
  <pre><code>profiling:/Library/Server/Xcode/Data/BotRuns/Cache/c0jhd288-c473-c473-2432-f8219hdh98dh89/DerivedData/Build/Intermediates/AppName.build/Debug-iphonesimulator/appName.build/Objects-normal/i386/ClassName.gcda: cannot open
  </code></pre>
  
  <p>I know this is occurring during the application's gcov flush because I placed a log directly before and after the call"</p>
  
  <pre><code>NSLog(@"[application performSelector:@selector(gtm_gcov_flush)]; will be CALLED");
  [application performSelector:@selector(gtm_gcov_flush)];
  NSLog(@"[application performSelector:@selector(gtm_gcov_flush)]; was CALLED");
  </code></pre>
  
  <p>NOTE: <code>gtm_gcov_flush</code> only calls <code>__gcov_flush()</code> and nothing else. </p>
  
  <p>Searching for "profile gcda: cannot open" lead me <a href="https://stackoverflow.com/questions/4680652/iphone-cannot-get-simulator-to-generate-gcda-profiling-data-files">here</a>, but I am already following the suggested requirements by following the above blog link. It is possible there are some permission issues but that seems unlikely since Xcode is the one generating the gcda files.</p>
  
  <p>I have checked the <code>/Library/Server/Xcode/Data/BotRuns/</code>, <code>/Users/username/Library/Developer/Xcode/DerivedData/</code>, and <code>/var/_xcstest</code> directories and their subdirectories for gcda files and there are none in sight. However, there are gcno, o, d, and dia files in <code>/Library/Server/Xcode/Data/BotRuns/Cache/c0jhd288-c473-c473-2432-f8219hdh98dh89/DerivedData/Build/Intermediates/AppName.build/Debug-iphonesimulator/appName.build/Objects-normal/i386/</code> (where there should be gcda files).</p>
  
  <p>Like I said, I have had zero issues with the while running locally. The script XcodeCoverage/getcov is being called in the post-action phase of Archive in my scheme. I am using Xcode 5.0.2 on my development mac as well as via Xcode service on the CI server. Unit tests are being ran with the XCTest framework.</p>
  
  <p>Thanks for your help in advance!</p>