我正在尝试在xamarin.ios应用程序中实现后台获取,尽管启用了后台获取,但从未得到调用。
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// tried this also
// UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);
UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(60);
// Other code
}
public override async void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
{
Console.WriteLine("Perform fetch called..!!");
var result = await FetchImage("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png");
completionHandler(result);
}
答案 0 :(得分:0)
您是否在info.plist中请求了正确的权限?
您将最低背景提取间隔设置为60,但建议不要低于900。
我建议看一下this xamarin blogpost about performing Background data fetches。详细并且很好地解释了。