繁体   English   中英

从不调用PerformFetch

[英]PerformFetch is never called

我正在尝试在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);
}

您是否在info.plist中请求了正确的权限?

您将最小背景获取间隔设置为60,但建议不要低于900。

我建议看一下有关执行背景数据获取的xamarin博客文章 详细并且很好地解释了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM