【问题标题】:crash when using EKEventEditViewController使用 EKEventEditViewController 时崩溃
【发布时间】:2012-05-03 17:51:32
【问题描述】:

我有一个奇怪的崩溃,我不知道如何调试...... 代码如下:

-(void) addEventButtonPressed:(UIButton*)button{
DLog(@"Add new event");
// If event is nil, a new event is created and added to the specified event store. New events are 
// added to the default calendar. An exception is raised if set to an event that is not in the 
// specified event store.
// When add button is pushed, create an EKEventEditViewController to display the event.
EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];

// set the addController's event store to the current event store.
addController.eventStore = self.eventStore;
addController.editViewDelegate = self;

// present EventsAddViewController as a modal view controller
[self presentModalViewController:addController animated:YES];

}

我的应用程序在这一行经过很长时间后崩溃: [self presentModalViewController:addController Animation:YES];

我正在使用 ARC。 有什么线索吗? 谢谢!

我的控制台只显示EXC_BAD_ACCESS(code=2, address=0xbf7ffff4)

[编辑] 似乎eventStore 需要在将其传递给addController 之前进行初始化,否则您会崩溃。就我而言,它是零。

【问题讨论】:

  • 你在控制台上读到了什么?
  • 只是 EXC_BAD_ACCESS,但需要很长时间才能到达那里.. 就像内存不足之类的)

标签: cocoa-touch ios4 ios5


【解决方案1】:

确保您从主线程呈现 EKEventEditViewController;如果您从辅助线程呈现它,它将崩溃(并非总是,但通常)。

【讨论】:

    猜你喜欢
    • 2012-02-17
    • 1970-01-01
    • 2017-12-25
    • 2020-12-18
    • 2014-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-27
    相关资源
    最近更新 更多