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

DependencyService not seeing iOS implementation

$
0
0

Hey everyone, I am trying to use DependencyService with the following implementation and on Android it works great, iOS it says there is not a registered service when I do a Get against it.

Here's the call that works great in Android. 0% in iOS:

            AllTeamsData = await DependencyService.Get<IDataService> ().GetAllTeams ();

Any ideas? I'm out.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;

using CFBTV.iOS.NativeImp;
using CFBTV.Data.Models;
using CFBTV.NativeInterfaces;
using Microsoft.WindowsAzure.MobileServices;
using Xamarin.Forms;

[assembly: Dependency (typeof (DataService))]
namespace CFBTV.iOS.NativeImp
{
    public class DataService : IDataService
    {
        public static MobileServiceClient MobileService = null;

        static DataService()
        {
            MobileService = new MobileServiceClient(
                "someazureserviceurl",
                "somekey"
            );
        }

        public DataService() {}

        public async Task<List<team>> GetAllTeams()
        {
            var result = await MobileService.GetTable<team> ().Take(1000).ToListAsync ();
            return result;
        }

    }
}

Viewing all articles
Browse latest Browse all 58056

Trending Articles