小编Pau*_*dan的帖子

NSNotificationCenter的帖子导致"EXC_BAD_ACCESS"异常

A UIViewController将自己添加到默认中心:

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(editFood)
 name:@"editFood"
 object:nil];
Run Code Online (Sandbox Code Playgroud)

然后UITableView代表NSObject发布一个NSNotification:

[[NSNotificationCenter defaultCenter]
 postNotificationName:@"editFood"
 object:self];
Run Code Online (Sandbox Code Playgroud)

在运行时,它会获得EXC_BAD_ACCESS异常.

是在defaultCenter哪里获得释放?当我从UIViewController向UIViewController发布通知时,同样的概念也有效,但这不重要,对吧?

iphone exc-bad-access objective-c nsnotificationcenter ios

62
推荐指数
2
解决办法
2万
查看次数