Xamarin.iOS - Linker behavior: Link All - Assets images removed - ios

Has anyone experienced the images loaded in the Assets Catalog of a Xamarin.iOS project being removed when using the Linker behavior: Link All?
I have the following solution structure (simplified):
MyApp.csproj (shared code)
MyApp.iOS.csproj (iOS project)
Assets
And I compile with the following mtouch arguments:
--linkskip=MyApp --linkskip=MyApp.iOS
Besides the fact of the images not showing up, the rest of the app works flawlessly.
I am using Visual Studio 2022 version 17.2.5; Xamarin version 17.2.0.177
Update:
Interestingly, if I replace the Xamarin.Forms.Image implementations for FFImageLoading.CachedImage, the images are not affected by the LinkAll configuration.

Well, trying to create a reproducible sample I came across the problem.
Basically, the following line CachedImageRenderer.InitImageSourceHandler(), introduced when using FFImageLoading, was messing up with Xamarin.Forms.Images when the linker was set to LinkAll.
The documentation of FFImageLoading is not super clear on what this line is for, but removing it fixed the problem.

Related

Xamarin iOS Could not AOT the assembly Microsoft.EntityFrameworkCore.Migrations.Migration

We've added migrations to our xamarin forms project and ever since then we can't deploy it to an iOS device. It will run on the simulator fine but will fail with AOT errors on deploying to device.
It seems to be a fairly wide spread topic over the web but none of the ideas so far have made a difference. We're using EntityFrameworkCore v2.2.6 along with xamarin.forms v4.1.0.
I've tried adding the -v -v -v for more details on the build log but still just get:
Error Could not AOT the assembly '/Users/MyUser/Library/Caches/Xamarin/mtbs/builds/MyCompany.Mobile.iOS/8fcd0a31c7f6e1a671890e2462fe729f/obj/iPhone/Debug/mtouch-cache/3-Build/MyCompany.Data.Persistence.dll' MyCompany.Mobile.iOS
Any ideas what else I should try?
I haven't try these but it could fix your issue
IOS Build -> General -> and uncheck the option Incremental Build.
Disable LLVM.
Remove all unnecesary classes, methods from your MyCompany.Data.Persistence.dll so it wont generate heavy code.
Change Linking to Link All Assemblies
Xamarin.Android applications use a linker to reduce the size
The default value is SdkOnly
None: No linking will be attempted.
SdkOnly: Linking will be performed on the base class libraries only, not user's assemblies.
Full: Linking will be performed on base class libraries and user assemblies. For more details refer here.. Note: if you are facing an issue with linking such as
"GetAdditionalResourcesFromAssemblies" task failed unexpectedly. System.IO.FileNotFoundException: . Perhaps it doesn't exist in the Mono for Android profile?
then recheck your xamarin.Android project settings and set the below tag,
true
It Should Solve Your Problem.

Lexical or preprocessor issue in react native while building ios app <React/RCTUtils.h> not found

When I am trying to build my ios app in xcode, the build is failing due to lexical or preprocessor issue the error shows up like this
This was a problem specific to the react-native-device-info module.
For your specific case you may try v1.6.1 or higher (currently at 2.0 as of May 21, 2019) of the library and that should fix things for you.
For others interested more generally in the problem, this is a react-native library that uses native code, so it has an XCode project embedded within it for use in react-native after you run react-native link react-native-device-info. Unfortunately, the library was not including any directories in it's header search path, so it was of course unable to find the header files for the react-native objects it was using locally.
A library user proposed a change that fixed that problem for tvOS, and I extended the change to cover iOS as well, and now the library no longer generates errors like this for iOS or tvOS targets.
Perhaps someone with a similar issue may find the specific changes required for the fix useful in their projects

Couldn't get Xamarin projects working with Rider-EAP on OSX

I was really excited, when JetBrains launched the Project Rider-EAP. First thing I've tried was to get a Xamarin-iOS project to run in Rider-EAP, but it doesn't work out of the box.
Update 1: This issue is now listed as critical bug with fix in EAP 2: https://youtrack.jetbrains.com/issue/RIDER-618
1. Problem (fixed) Projects didn't load with the exception that Xamarin.iOS.targets could not be found.
I fixed this with a simple Symlink:
ln -s /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/ “/Applications/Rider EAP.app/Contents/lib/ReSharperHost/macos-x64/mono/lib/mono/xbuild/”
2. Problem
References are not loaded correctly. Therefore the whole syntax highlighting and everything beyond is broken.
See screenshot: References are not loaded correctly
I get the following error as well:
Error:null: Error initializing task MakeDir: Could not load file or assembly '/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Tasks.dll' or one of its dependencies
Switching the xbuild to mono 4.2.2 removes the error but not solves the problem.
PS: It seams that the references are loaded correctly for Xamarin Android projects.
Basic Xamarin Support like open and build is added with EAP 8 of Project Rider.
More advanced features will come with the next Builds and are tracked here: https://youtrack.jetbrains.com/issue/RIDER-1533

Adding Mapbox to iOS project

So, ... I went through the tutorial, using the binary steps to go through this.
I went through some answers here and that's where it gets confusing as there are even more variations on which linker flags to add and header paths, etc.
I tried these: MapBox iOS SDK within your own Xcode no help.
The project doesn't find the classes/headers.
The only project I found that works is their sample XCode project. I replicated all those dependencies, no luck.
I could put all my code into the iOS example, but it over a year old and not indicated to include the latest version 1.6.1.
I hate cocoapods as they add too much setting up into the project and if I get the same issue with other 3rd party frameworks, (there's plenty ill documented out there) how woudl I add that?
So, anyone else having those issues of the Mapbox tutorial not working and what was your solution?

Monotouch binding issue after updating to xcode 4.5

I had previously managed to get a test program in MonoTouch working with the Nuance SpeechKit by following the steps detailed in this post.
I have since updated everything to the latest and greatest (IOS 6.0, xcode 4.5 etc.).
The first time I followed all of the same steps as before I had issues regarding ARMv6 support. I believe I correctly changed the architecture settings of the project to remove the ARMv6 references. I was able to follow the binding steps (from post above) and everything seems to build ok.
The problem I'm seeing is in the MonoTouch project. After replacing the referenced DLL with the newly created one, I'm getting missing reference errors.
It seems as though the newly created DLL is not exposing the SpeechKit framework. (The older original DLL showed the SpeechKit framework just fine.)
(I am definitely a beginner so forgive me if I mutilate the following...)
The original steps I followed to create this binding (linked to above) had me create a wrapper file in the xcode project. The code in this wrapper references the SpeechKit framework. There is a comment in the example that indicates this code is not actually used but is needed for the linking. (Comments below)
// the SpeechKitWrapper isn't actually used - rather, it is a way to exercise all the API's that
// the binding library needs from the SpeechKit framework, so that those can be linked into the generated .a file.
To me the problem seems to be that the steps I'm following no longer does this. I don't know if there is a project setting or something that has changed that causing this. Or maybe something completely unrelated.
Does anyone have any insight into what might be going wrong for me?

Resources