Cannot build Xamarin.Forms iOS project - ios

I am trying to build our Xamarin.Forms application on Azure DevOps, but it fails for iOS with the following error:
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(18,2): error GB12A9FDE: "Photos requires C++11 or later" [/Users/runner/runners/2.159.2/work/1/s/My_MobileApp/My_MobileApp.iOS/My_MobileApp.iOS.csproj]
The app was originally created on VS 2017, then migrated to VS 2019. It worked, but stopped building yesterday for some reason.
What can I do to fix it?

OK, it is resolved:
We added a command line task prior to the xamarin.ios build task with the following inline script:
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'$(xcode.root);sudo xcode-select --switch $(xcode.root)/Contents/Developer"
and set a variable named xcode.root to /Applications/Xcode_10.3.app in order to override the faulty version of xcode on the build agent
This is kind of hacky, so once the issue is resolved upstream we will need to remove that override.

Related

Dotnet Watch Run gives me a Rosetta Error: attachment of code signature supplement failed: 1 after save

I'm having a problem with my .Net Core 3.1 Project. I'm using Docker for hosting the MS SQL Database (image azure-sql-edge) and I run it on a MacBook Pro M1 Max.
When starting the project with Dotnet Watch Run everything works ok but after a save in Visual Studio Dotnet Watch Run restarts and gives me an error:
rosetta error: /var/db/oah/0cbcd548c398ac044cf47633c4e5aa068c1a0416a18ad1861a768ac56fd1d33b/68b61c75aa9514f21db1470814e91bac8c95ea1a32f4e42fc88601dc4eeac1fc/Project.aot: attachment of code signature supplement failed: 1
And Dotnet watch gives a:
dotnet watch ❌ Exited with error code 133
Anybody has a clue what's going wrong here?
I am a frontend developer and I am no expert in dotnet, it just so happened that our backend is dotnet and In my case, running dotnet clean then running my backend again dotnet run --project=MyProject help me solve this issue. Hope this helps you solve your issue.
I got same issue on M1 with .netcore 3.1
tried serval things. but didn't solved. but, yesterday my co-worker said try run dotnet clean and It works like magic.
since before I have to reboot my pc everytime when this error occured. and now I am happy. hope this simple command helps.
once again, just run dotnet clean no other flags used.
I had the same issue and resolved it by updating the target framework to the newest version on my machine - typing "dotnet --version" into the command line will show you the latest version you are running.
For me it was going into the .csproj file and updating the target framework within there. Hope that helps
After updating Dotnet DSK to 3.1.425 (release date November 8th 2022) the issue was fixed.
I had the same issue on M1 with .Net 6.0.402. Upgrading MacOS to Ventura 13.0 (22A380) solved it for me.
Updating to latest SDK 7.0.100-rc.2 did not help here.

Fastlane Apple Generic versioning not enabled in this project

What I’m doing is trying to make bitbucket pipline do my iOS CD, I included docker fastlanetools/fastlane image and in the steps i pull and run the docker image everything is okay and i was able to let fastlane command work by calling fastlane beta in the steps.
What’s happening is that fastlane exits with the error
Apple Generic versioning is not enabled in this project.
I followed apple documentation to enable it from xCode
from here
I changed all the targets in my project to use App Generic and still not working
In case it was this issue xcrun avgtool xcrun: error: unable to find utility "avgtool", not a developer tool or in PATH
after
sudo xcode-select -s /Applications/Xcode.app
fastlane stopped complaining
In my case it was the issue of Command Line Tools, which wasn't specified under the location tab.
Add your xcodeproj path.
Like
increment_build_number(
xcodeproj: '../XXX.xcodeproj',
build_number: number
)
I met the same problem. I searched and tried a lot of ways, but still not worked it out. A flash of inspiration came to my mind. I set a certain version via increment_version_number, it was succeeded magically. Then I tried increment_version_number again to make it automatically increment the version number. Lucky me, it worked.
I had two installations of macOS but Xcode only on one of them, after updating I lost the command line tools location. After setting that up in the preferences it worked again
What i missed was missed setting CURRENT_PROJECT_VERSION
(whz. Current Project Version) build setting, which specifies the current version of your project.
Reason:
By default, Xcode does not use any versioning system & no value for Current Project Version. So setting versioning system to Apple Generic ensures that Xcode will include all agvtool-generated version information in your project.
Reference
So make sure, your below set values for
I highly recommend using this plugin if your issue is not having argvtool accessible in CI/CD when trying to bump stuff uniformly for both IOS/Android before it does it in the macOS runner or action etc
In my case this problem appeared after I updated Xcode and my xcode-select was pointing to the missing folder.
After I executed xcode-select -s /Applications/Xcode_13_4.app Fastlane continued working as it used to before.

xcode - command line build - required content for platform watchOS is missing IBBuildSupport

I am trying to build my project (iPad app) from go agent. While building from command line, I am getting below error.
Error log:
Requested but did not find extension point with identifier Xcode.IBBuildSupport.AssetCatalog.AssetTagScanner.TypeExtension
go-agent: error: Initialization failed.
Reason: Required content for platform watchOS is missing
I am not using/referring to any of watchOS related libraries. Any one faced similar kind of error?
This seems to be a problem in GoCD to do with an environment variable that is being set by the GoCD agent.
A Github issue has been opened to fix this.
Meantime, if you have a look at the chat there you'll see that the original reporter has found a workaround, which is to call unset CFProcessPath before invoking the xcodebuild command.
In my case, I changed the custom command I was using to:
unset CFProcessPath; bundle exec fastlane build_for_test
and the build is passing
(I tried using a separate command for the unset CFProcessPath, but the environment variables appear to revert between them - so I was forced to combine the two).

Can't run unit tests in Xcode 8 with earlier unit test configuration

I ran into this issue after upgrading to Xcode 8. When running the tests I get this error at run time:
/Users/<me>/work/<appname>/Build/Intermediates/<appname>.build/Debug-iphonesimulator/<appname>UnitTests.build/Script-231C35D610AC1F5000D830C2.sh: line 3: /Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests: No such file or directory
The sh script in the error message is trying to access the RunUnitTests tool and fails. I assume this tool has been removed in Xcode 8. It seems that for my project Xcode tries to run tests in a way that is no longer supported. If I create a brand new project no such script is created and I can run tests.
Any idea what settings I need to update in my project to get the tests running again? I tried the 'Update to recommended settings' checklist but it doesn't solve this issue.
It seems I only needed to remove the Run Script phase that invoked that script.
Removing Run Script from the Build Phases didn't help me.
I simply copied /Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests from my older Xcode into my XCode 8 package content. Give it right permissions:
RWXR-XR-X
And it worked for me.

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