【问题标题】:Add data to native iPhone app from our application in iPhone从我们在 iPhone 中的应用程序向原生 iPhone 应用程序添加数据
【发布时间】:2010-08-06 18:29:19
【问题描述】:

如果我开发了一个应用程序,我们可以通过该应用程序选择日期和时间并输入文本,并且应该为本地 I 电话日历的相应日期和时间添加该文本。有什么方法可以实现吗?

【问题讨论】:

标签: iphone calendar


【解决方案1】:

是的,应该可以使用 EventKit 框架(在 iOS 4.0 中引入)。 EKEvent 是您可能正在寻找的课程。

【讨论】:

    【解决方案2】:

    我用这个代码

    EKEventStore *eventStore = [[EKEventStore alloc] init];
    if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
    {
        // the selector is available, so we must be on iOS 6 or newer
        [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
            dispatch_async(dispatch_get_main_queue(), ^{
                if (error)
                {
                    // display error message here
                }
                else if (!granted)
                {
                    // display access denied error message here
                }
                else
                {
                    // access granted
                    // ***** do the important stuff here *****
                }
            });
        }];
    }
    else
    {
        // this code runs in iOS 4 or iOS 5
        // ***** do the important stuff here *****
    }
    

    【讨论】:

      猜你喜欢
      • 2011-09-02
      • 2013-08-14
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 2013-06-08
      相关资源
      最近更新 更多