XCode: Why is my event not being added to the calendar?

后端 未结 1 870
余生分开走
余生分开走 2021-01-18 21:33

I have added the following code to my app:

NSDate * selected = [DatePicker date];
NSString * date = [selected description];

NSDateComponents *components = [         


        
相关标签:
1条回答
  • 2021-01-18 21:46

    Your event needs a valid time span to save it. Try this

    event.startDate = selected;
    event.endDate = [selected dateByAddingTimeInterval:30*60]; //30 minutes for example
    
    0 讨论(0)
提交回复
热议问题