【问题标题】:iOS Calendar restriction caused app to crashiOS 日历限制导致应用崩溃
【发布时间】:2013-02-18 09:03:11
【问题描述】:

这是我的场景:

我正在从我的应用程序向 iOS 日历添加一个事件。就在添加事件之前(正在显示日历的添加事件视图),如果用户转到设置-->常规-->限制-->日历并限制我的应用程序的权限,则应用程序崩溃。

有人遇到过这样的问题吗?有什么线索吗?因为 xcode 在崩溃时没有提供任何相关日志。我在 iOS 6.0 iPod Touch 上运行应用程序。

希望有人能提供帮助。

【问题讨论】:

    标签: ios6 calendar settings ipod-touch restrictions


    【解决方案1】:

    首先获得访问日历活动的权限,然后添加活动。 获取权限的代码

    EKEventStore eventStore = [[EKEventStore alloc] init];

    if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
    {
        [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error)
         {
             if (granted){
    
                 MLLog(@"Wipe : getEventStorePermission : permission granted");
             }
             else{
                 MLLog(@"Wipe : getEventStorePermission : permission not granted");
             }
         }];
    }
    else{
    
        MLLog(@"Wipe : getEventStorePermission : permission not required");
    }
    
    RELEASE_OBJECT(eventStore)
    

    【讨论】:

      猜你喜欢
      • 2015-11-19
      • 2012-10-09
      • 1970-01-01
      • 2016-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多