In my case, I need to write a library for xamarin.forms which is based on native code. When I link to a project with xcframework from my XamarinForms.iOS.Sample I get the Failed to resolve assembly error. This leads to the question whether can I add the xcframework to the xamarin forms project?
Any thoughts or other suggestions?
Related
I am trying to get an App to work with OTA Nordic Dfu, and the only xamarin nuget I can find was the one made by Laerdal on GitHub
When I try to build under iOS I am getting a few error like this one here:
Error MT5211: Native linking failed, undefined Objective-C class: _TtC13iOSDFULibrary11DFUFirmware. The symbol '_OBJC_CLASS_$__TtC13iOSDFULibrary11DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.
A bug is open for this, but so far not a word from the people maintaining it.
I am left wondering if this is actually a local problem and not a problem with the nugget its self. So if any one out here is able to compile this under iOS help would be really appreciated.
So yesterday this line:
ATTrackingManager.RequestTrackingAuthorization((status) => {
if (status == ATTrackingManagerAuthorizationStatus.Authorized)
{
}
was working code (in my cross-platform Xamarin.Forms PCL).
Today xamarin.ios received an update.
In the PCL project, the tracking manager is not found anymore. Intellisense doesnt know what it is anymore and I cannot debug the app.
It is recognized in the xamarin.ios project, but I need to access it from my PCL.
Anyone having the same issue and / or has already found a solution?
How can I rollback to xamarin.ios before the one I received today?
Don't need to rollback. As a test, I updated
Visual Studio (which also updated Xamarin.iOS).
XCode to 14.5.1.
Then I added a line of code to an existing Xamarin Forms solution, that referenced AppTrackingTransparency.ATTrackingManager. This was recognized as valid code. I Also tried just ATTrackingManager, and Intellisense correctly told me I needed using AppTrackingTransparency.
So its there now.
That namespace+classname is specific to iOS, so must be referenced from the iOS-specific project. (If it previously was referenceable in the PCL, that was probably a bug that has since been corrected; such code would break on any other platform.)
First step:
In your iOS project, write code that references that class.
Second step:
You need to know how to use your custom iOS code from the cross-platform Xamarin Forms PCL.
I won't repeat that here - there are multiple Q&As on that topic.
google "stackoverflow xamarin forms call platform specific code".
I am using Visual Studio For Mac. My Xamarin Forms project is quite large and contains many content pages. Some of them will be only used in android project and some of them only used in iOS project. There is no problem when I compile the project into android. However, when I want to compile the project into iOS, it seems like did not accept anything related to android. Please refer to the screenshot. There is no way I can include the android specialised reference and compile into iOS project. So, any idea to deal with this? Maybe there is a way to force build the iOS project no matter what? The error from the screenshot is from the page that will be only used in android. So what I can do for now is delete the page when I want to compile as iOS and recreate the page when I want to used it for android. But there are plenty of them, it is too heavy for me to do this every time. Please help.
You can't call platform specific APIs at the .NET standard libraries that are used to host Xamarin.Forms code by default.
Basically you have those options:
1) using shared project instead of library and using conditional compiling (easier but it is now not available as the option when creating the project)
2) using dependency injection.
I need to create an Android class library and add Xamarin.Forms and Xamarin.forms.Maps
So I created an empty project I get
Nuget Xamarin forms gives "this collection is read only" output
Added package 'Xamarin.Forms.2.5.1.444934' to folder
'C:\MyTemp\TestApp\packages'
Install failed. Rolling back...
So
I have cleared the nugetcache but nothing.
This is driving me mad and looked at bugzilla and it seems to be an issue but all the workaround do not fix it.
Can you create an android class library and add xamarin.forms and maps to it?
thanks
In my case i have cleared the nuget cache and suppress the folder Cache at C:\Users\user_name\AppData\Local\Xamarin.Android for resolve this problem
I'm trying to build a simple barcode scanner using Xamarin forms and I'm using ZXing Library (I copied/added the Dlls manually).
when i build the project i get the following errors:
'Resource.Id' does not contain a definition for'contentFrame'
'Resource.Layout' does not contain a definition for 'zxingscanneractivitylayout'
'Resource.Layout' does not contain a definition for 'zxingscannerfragmentlayout'
I did my research before posting this, I know that the error has something to do with the "Resource.Designer.cs" file not being updated but I honestly don't know how to fix this.
I also found this old post with the same problem
[Unknown globals when installing ZXing Scanner
but nothing suggested worked for me.
Any Idea, how can this error be fixed, Thanks for your help.
Edit : I'm using Visual Studio Enterprise 2015 and Xamarin Forms v2.2.0.45
Just update to Zxing.Net.Mobile 2.1.0.1 beta prelease and the errors will disappear.
The problem is widely known
Xamarin bugzilla
Issue on Github repository of Zxing