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

DependencyService.Get() returns null; Only 1 platform installed.

$
0
0

I only have the iOS platform on my Xamarin.Forms project, no Android or WinForms.

Everything I have read about the DependencyService is that it requires you to register the implementation of the interface on every platform, which I assume means every platform in the project. If that is the case then I have done that.

HelloWorld.csproj - public interface ISQLite {...}

HelloWorld.iOS - [assembly: Xamarin.Forms.Dependency(typeof(SQLite_iOS))]] public class SQLite_iOS : ISQLite {...}

I have no other projects.

Each time I call Xamarin.Forms.DependencyService<ISQLite>.Get(), it returns only null.

I'm sure I have done something wrong, but I have reread the dependency service guide twice now.

Thanks in advance!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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