【发布时间】: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