在Windows Phone 7上使用ShellTileSchedule时出现InvalidOperationException

Jul*_*eña 2 windows-phone-7 windows-phone

使用以下代码创建ShellTileSchedule时,我收到InvalidOperationException:

ShellTileSchedule sch;
public void UpdateTile()
{
    sch = new ShellTileSchedule();
    sch.Recurrence = UpdateRecurrence.Interval;
    sch.Interval = UpdateInterval.EveryHour;
    sch.StartTime = DateTime.Now;
    sch.RemoteImageUri = new Uri(@"http://winmilk.julianapena.com/Tile3.png");

    sch.Start();
}
Run Code Online (Sandbox Code Playgroud)

特别是在调用时会发生异常sch.Start();.无论是使用间隔更新还是一次性更新,都会发生这种情况.

任何人都知道为什么会这样?

提前致谢!

Jul*_*eña 5

Doh,找到了答案.没有添加

<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>

到WMAppManifest.xml文件.

有点误导,因为ShellTileSchedule的文档说它正在更新磁贴"没有推送通知".至少它现在有效:)