Xcode Bot CI | Unable to find matching destination - ios

I have setup an Xcode server and using Xcode Bots to do CI in my machine. (Same is used for development.)
Creating a bot for a project, works fine. However, if I add the same project to the workspace, (I have shared the scheme - [which is set to the workspace container] so that is not the issue.) I am getting the below error.
xcodebuild: error: Unable to find a destination matching the provided
destination specifier:
The git currently resides on the Xcode server.
(Followed the steps here)
Also noticed that, once I clone the repository and open the .xcworkspace, the project and the scheme is not displayed.
I suspect this to be the issue. However, not able to find a way to fix this. Any help is greatly appreciated. Thanks!
[Using Xcode version: 7.3.1 on OS X El Capitan v: 10.11.4]

Related

XCode Swift package manager error behind proxy

We use Swift package manager embedded in XCode for the dependencies in our project. Everything works fine when using it on the local machine. However when I try to build the project on our ci slaves I get the following error (when run from both XCode and the console) :
xcodebuild -resolvePackageDependencies
Resolve Package Graph
Fetching https://github.com/hmlongco/Resolver.git
xcodebuild: error: Could not resolve package dependencies:
An unknown error occurred
The difference between running it locally and on the ci slave is that the ci machines are configured behind a proxy. We already whitelisted all the URLs that were accessed when running this command, however the problem still persists. I couldn't find any detailed log about this error.
From examining the network packages sent when I run the command we can still see that some app is trying to access the direct URL instead of going through the proxy and here timeout is received. We only use public packages on github and there isn't any authentication needed.
From other side if the project is set up the old way using Package.swift and we run:
swift package resolve the dependencies are successfully resolved without errors.
I have already gone through the following but there wasn't any helpful solution:
Configuration for enterprise networks
XCode proxy settings
SPM in real life projects
Same issue on developer forum
SSH error resolving dependencies - no ssh dependencies
Also there isn't any documentation about how resolving the packages through XCode is different than using 'swift package'.
Currently I'm not sure whether it's possible to configure something so XCode uses the proxy settings for SPM or the Xcode SPM through proxy is just not supported. Any ideas? Any help is appreciated!
From what I just found, at least for Xcode 12.4, there's -scmProvider option for xcodebuild:
-scmProvider which implementation to use for Git operations (system/xcode)
If I guess it correctly, -scmProvider system would force xcodebuild use "system" git. That, in turn, in my case, makes it respect the git config settings I have, particularly proxies.
Hence, answering the original question, it's probably worth trying
xcodebuild -resolvePackageDependencies -scmProvider system
(as long as Git config is properly set up)
Turns out there was an easy fix if we just configure the proxy for using it with git:
Getting Git to work with a proxy server - fails with "Request timed out"

Error while creating own spec git public repository pods

I am trying to create my own pods following tutorial
However when I added my code to the pods project and tried to push it. Then I get following error -
ERROR | xcodebuild: /Users/klouddata/Documents/Developer/MyPods/Classes/PDRatingsView.m:87:44: error: no visible #interface for 'UIApplication' declares the selector 'openURL:options:completionHandler:
I dont understand how to solve this error.
Thanks
To push pods your repo can't have errors (I believe it can't even have warnings). If error doesn't exist during building your framework then pods build it differently (maybe with different swift version?). To set swift version during pods building use command (found on pods website but didn't try it)
echo "3.0" > .swift-version
Personally I used following command (which is "bad way")
export TOOLCHAINS=com.apple.dt.toolchain.Swift_3
without understanding the problem somebody given the negative marks to this question,
Any ways after long research i found the answer myself.
As mentioned in ERROR | xcodebuild:, path for xcode build is different as i have in my system old xcode installed so need to change the path and I've to run both Xcode 7 (to build old version) and Xcode 8 (to build current develop branch)
using following command
launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true

xcode 7.3.1 can't connect to git

I am using Xcode 7.3.1. on Mac El Capitan. I have cloned a project from its repo in terminal but when I try to add a repository using Xcode - Preferences -> Accounts I get authentication failed. The same happens when I try Source Control -> Checkout.
I am following the instructions here: https://docs.fabric.io/apple/beta/beta-walkthrough.html#add-udid
I have tried both gitosis#myserver:myproject.git and ssh://gitosis#myserver:myproject.git.
In terminal, git clone gitosis#myserver:myproject.git works fine.
I do have git-flow in this repo, could that upset xcode? I have tried just checking out master branch and using that with xcode but it didn't make any difference.
Another possible problem is that my git config file sets a port different to 22 and it may be that xcode does not pick this up from the config file and uses port 22 regardless?
I finally fixed this by entering the git connection string as ssh://myserver.com:2245/my-project.git.
Xcode apparently does not read my config file which was evident when it prompted me for the default certificate id_rsa instead of the one specified for the named server, together with the port specified in my ~/.ssh/git/config file.
I hope this helps somebody not to waste a couple of days as I did.

fatal error: 'Fabric/Fabric.h' file not found

I am working on xcode 6.3.1, OSX 10.10.3 and I have configure crashlytics successfully with my local system. it work fine and it release the build via fabric app. But when I transfer same codebase to teamcity it was showing me following error
fatal error: 'Fabric/Fabric.h' file not found
fatal error: 'Crashlytics/Crashlytics.h' file not found
After investigation, I found that following unknown issue in my teamcity server. Teamcity got the source from git and when I see the source code in teamcity, Crashlytics.framworks & fabric.framworks are available but when you look into folder structure it could not figure out shortcuts for all headers, modules, resources, crashlytics folder (pic-1).
I get the other git clone in other folder and manually pull source code, here I can see the all shortcuts for crashlytics & fabrics sub folders. (pic-2).
I just copied all folders and pasted in teamcity source code. Now it works but every time when source code changed, teamcity reset to non-shortcut folder structure which will fail my builds. I am not sure this is GIT issue or teamcity or crashlytics issue. Please let me know how to figure out. I appreciate you answers.
Thanks
Manoj
Its a Teamcity configuration issue.
When you include libraries, if using git to get the code you have to change the Version Control Settings.
Change VCS checkout mode to Automatically on agent. This will fix your issue. There is a problem with the teamcity git client which messes up the symlinks so the libraries dont actually download correctly.

List command hangs in xcode

I am using the Jenkins Xcode plugin (https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin) to build an iOS application, however it hangs when running the following command on a project I have inherited from another developer:
$ /usr/bin/xcodebuild -list
It also hangs when I run this command manually from a terminal. Does anyone know what the cause may be? The warning displayed is also displayed on another project I have, but it does not hang in this case.
Running Xcode 6.1 on OS X 10.10
$ /usr/bin/xcodebuild -list
2014-11-12 04:47:21.234 xcodebuild[42642:1431240] [MT] DVTAssertions: Warning in /SourceCache/IDEFrameworks/IDEFrameworks-6604/IDEFoundation/SourceControl/Model/IDESourceControlManager.m:423
Details: Error Domain=com.apple.dt.IDESourceControlErrorDomain Code=-1 "Missing extension: public.vcs.subversion" UserInfo=0x7f9792309200 {NSLocalizedDescription=Missing extension: public.vcs.subversion}
Object: <IDESourceControlManager: 0x7f9792302860>
Method: -loadRepositories
Thread: <NSThread: 0x7f9790d2dbe0>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Information about project "DOHSmokefree":
Targets:
DOHSmokefree
DOHSmokefreeTests
Build Configurations:
Debug
Release
If no build configuration is specified and -scheme is not passed then "Release" is used.
TLDR; My solution: Mark the schemes as shared in XCode if building them from the command line as a different user, or without ever opening XCode on the build machine.
I was having this same problem, intermittently on our CI server. I came across this question. The accepted answer with the problem being an issue and fixing the SVN version did not work for me as the SVN being used on the CI server was the default SVN and it was, as mentioned, working intermittently.
What I finally noticed is that, between a working version and a non-working version the schemes were not being listed. I had recently upgraded a library on the project and that got me to thinking about the schemes. After realizing that schemes are stored locally per user, unless shared, the fix for me was to go into the scheme manager and mark the schemes as shared.
The problem apparently being that the CI server user never actually opened the project in Xcode, thus causing the list command to hang because there were no available schemes for the user to build.
The times when it had intermittently worked were times after, logged in as the CI server user, I had opened the project in Xcode to test the build process, thus creating the necessary schemes. Wiping the CI server or refactoring/adding schemes would cause the build to break until the project was reopened in Xcode in desperation.
I had a similar issue when updating to Xcode 6.1 while using a newer version of subversion on the command line.
Disabling Source Control in Xcode Preferences should do the trick.
If that isn't an option you might try replacing the subversion implementation inside Xcode as I have done, using this technique: Use SVN 1.7 in XCode 4.3+
Basically that would be the following steps:
This assumes you already have SVN 1.7 installed to /opt/subversion, you can get it from WANdisco: http://www.wandisco.com/subversion/download#osx
Now open the Terminal and get an elevated shell using sudo -s.
Then, cd to inside the XCode.app package, to where the SVN binaries are.
Make a backup directory and move the old SVN files into it
bash-3.2# mkdir bup
bash-3.2# mv svn* bup/
Lastly, symbolically link the new files into the package:
bash-3.2# ln -s /opt/subversion/bin/svn* ./
That’s it!
I have the same problem on OS X 10.10 with XCode 6.4,just close XCode's Source Control to solved this issue:
run XCode
open Menu: XCode -> Preferences...
Click "Source Control" Tab and uncheck "Enable Source Control"

Resources