【问题标题】:AppointmentManager.RequestStoreAsync throws system.unauthorizedaccessexception in Windows PhoneAppointmentManager.RequestStoreAsync 在 Windows Phone 中引发 system.unauthorizedaccessexception
【发布时间】:2015-07-13 19:13:19
【问题描述】:

我正在尝试从 Windows Phone 日历访问约会

public async Task <AppointmentStore> getAppointments()
    {

        AppointmentStore appointmentStore = await  AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);
        return appointmentStore;

    }

我已经在 PackageManifest 文件的 Capabilities 选项卡中“启用”了“约会”。在堆栈溢出的其他解决方案中,建议启用我所做的所需权限。我还以管理员身份运行了 Visual Studio。但是,系统继续抛出同样的未授权访问异常。

【问题讨论】:

  • 请从设备上卸载该应用程序。执行解决方案重建/清理构建,然后重试。让我知道这是否解决了它,发生在我身上。当然要确保功能已启用。
  • 我确实卸载了应用程序,清理并重建了解决方案。但是,它仍然显示相同的异常。我认为这可能与线程有关。
  • 你能发布堆栈跟踪吗?另外,它是 WP8.1 Runtime 应用程序还是 WP8.1 silverlight 应用程序。
  • 没关系,我在查看它时产生了错误。

标签: c# windows-phone-7 windows-phone-8 windows-phone-8.1 windows-phone-7.1


【解决方案1】:

使用AppointmentStoreAccessType.AppCalendarsReadWrite 时不会抛出异常。

使用AppointmentStoreAccessType.AllCalendarsReadOnly 会引发未经授权的异常。这无害,不会使应用程序崩溃。这只是意味着您没有 ChangeTracker 属性。

您仍然可以使用appointmentStore 对象并获取约会列表和其他内容。查看截图。

我希望你现在可以继续你的项目吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多