Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

"could not load type ... while decoding custom attribute"

$
0
0

Hi all,

I am getting the error from the title at runtime when calling DependencyService.Get<>() to access the iOS binding of a cross-platform interface.

It used to work fine with my ios app project, but because I need to be able to release several similar apps with different brandings, I created an iOS library project to contain the base code.

So my solution architecture changed from:

iOS "reader" binding library project
cross-platform project
ios app project referencing cross-platfom and binding, referencing the binding and containing interface implementation to the binding

to:

iOS "reader" binding library project
cross-platform project
iOS UI library project referencing cross-platform and "reader" binding library
ios app project referencing cross-platfom, referencing and containing interface implementation for the binding, as well as the UI library

(I hope that is clear enough...)

But calling DependencyService.Get() does not work anymore after trying to put my UI code in a library.
Here is what I tried so far to solve the issue:

-add [assembly: Xamarin.Forms.Dependency (typeof (MobileWallet.iOS.CardReader_iOS))] somewhere in the ios app (initially the Get returned null; after adding this to the ios app, I get "could not load type")
-setting the "don't link" option in the ios app configs
-add [Foundation.Preserve (AllMembers=true)] to the reader_ios implementing the interface (the class calling the reader binding)

None of this worked, has anyone an idea of what I am doing wrong?
thanks
Guillaume


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>