【发布时间】:2012-09-22 04:41:35
【问题描述】:
应用进入后台后我需要做一些处理,所以我将这段代码添加到我的应用中:
public override void DidEnterBackground (UIApplication application)
{
int taskid = 0;
taskid = application.BeginBackgroundTask(() => {
if(taskid != 0)
{
System.IO.File.WriteAllText(System.IO.Path.Combine(AppState.Current.User.Path, "blah"), "test");
application.EndBackgroundTask(taskid);
taskid = 0;
}
});
}
然后我监控了文件系统(模拟器应用程序)并且文件从未被写入目标。发生这种情况有什么原因吗?我错过了什么吗?
【问题讨论】:
标签: ios5 xamarin.ios